Skip to content

Commit

Permalink
Merge pull request #34111 from nextcloud/backport/34073/stable24
Browse files Browse the repository at this point in the history
[stable24] dont try email login if the provider username is not a valid email
  • Loading branch information
blizzz authored Sep 27, 2022
2 parents 1ac1aff + fbebc4b commit 20cd49c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/private/User/Session.php
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,9 @@ public function logClientIn($user,
if (!$this->login($user, $password)) {

// Failed, maybe the user used their email address
if (!filter_var($user, FILTER_VALIDATE_EMAIL)) {
return false;
}
$users = $this->manager->getByEmail($user);
if (!(\count($users) === 1 && $this->login($users[0]->getUID(), $password))) {
$this->logger->warning('Login failed: \'' . $user . '\' (Remote IP: \'' . \OC::$server->getRequest()->getRemoteAddress() . '\')', ['app' => 'core']);
Expand Down

0 comments on commit 20cd49c

Please sign in to comment.