aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-11-04 17:13:30 +0100
committerGitHub <noreply@github.com>2022-11-04 17:13:30 +0100
commit2efb8113015f6cb701268fb872281139e519cf39 (patch)
treed88ceafdc8f95625abd72a6e651a6cd8c09ce628 /lib
parent68a643d5cbdd6e26b63748e034122da826191109 (diff)
parent91a4444c2b231814190951d5a66815e8eec69e55 (diff)
downloadnextcloud-server-2efb8113015f6cb701268fb872281139e519cf39.tar.gz
nextcloud-server-2efb8113015f6cb701268fb872281139e519cf39.zip
Merge pull request #34947 from nextcloud/backport/34804/stable24
[stable24] Skip general login with email for non-valid addresses and LDAP
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Authentication/Login/EmailLoginCommand.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/private/Authentication/Login/EmailLoginCommand.php b/lib/private/Authentication/Login/EmailLoginCommand.php
index e2e55cc12c8..7145ab9e14f 100644
--- a/lib/private/Authentication/Login/EmailLoginCommand.php
+++ b/lib/private/Authentication/Login/EmailLoginCommand.php
@@ -38,9 +38,21 @@ class EmailLoginCommand extends ALoginCommand {
public function process(LoginData $loginData): LoginResult {
if ($loginData->getUser() === false) {
+ if (!filter_var($loginData->getUsername(), FILTER_VALIDATE_EMAIL)) {
+ return $this->processNextOrFinishSuccessfully($loginData);
+ }
+
$users = $this->userManager->getByEmail($loginData->getUsername());
// we only allow login by email if unique
if (count($users) === 1) {
+
+ // FIXME: This is a workaround to still stick to configured LDAP login filters
+ // this can be removed once the email login is properly implemented in the local user backend
+ // as described in https://github.com/nextcloud/server/issues/5221
+ if ($users[0]->getBackendClassName() === 'LDAP') {
+ return $this->processNextOrFinishSuccessfully($loginData);
+ }
+
$username = $users[0]->getUID();
if ($username !== $loginData->getUsername()) {
$user = $this->userManager->checkPassword(