summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2021-10-22 11:37:43 +0200
committerGitHub <noreply@github.com>2021-10-22 11:37:43 +0200
commitaef40c7cf485c48c7c9e8af96c419264cc5c5a10 (patch)
tree6d1e5ad5a6a5568097b8fc04c83f15aa8f4a1320 /lib
parent7e3b6e70882e53aee660892ed377020d1c577578 (diff)
parent1b8ebf2cf1ecdcd977b62cae158b7d9804b2e43e (diff)
downloadnextcloud-server-aef40c7cf485c48c7c9e8af96c419264cc5c5a10.tar.gz
nextcloud-server-aef40c7cf485c48c7c9e8af96c419264cc5c5a10.zip
Merge pull request #27876 from nextcloud/bugfix/noid/use-cached-user-backend-info-for-password-login
Diffstat (limited to 'lib')
-rw-r--r--lib/private/User/Manager.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php
index 3e30861f2a4..dbbfc2b53a2 100644
--- a/lib/private/User/Manager.php
+++ b/lib/private/User/Manager.php
@@ -246,7 +246,13 @@ class Manager extends PublicEmitter implements IUserManager {
$loginName = str_replace("\0", '', $loginName);
$password = str_replace("\0", '', $password);
- foreach ($this->backends as $backend) {
+ $cachedBackend = $this->cache->get($loginName);
+ if ($cachedBackend !== null && isset($this->backends[$cachedBackend])) {
+ $backends = [$this->backends[$cachedBackend]];
+ } else {
+ $backends = $this->backends;
+ }
+ foreach ($backends as $backend) {
if ($backend->implementsActions(Backend::CHECK_PASSWORD)) {
$uid = $backend->checkPassword($loginName, $password);
if ($uid !== false) {
@@ -257,10 +263,10 @@ class Manager extends PublicEmitter implements IUserManager {
// since http basic auth doesn't provide a standard way of handling non ascii password we allow password to be urlencoded
// we only do this decoding after using the plain password fails to maintain compatibility with any password that happens
- // to contains urlencoded patterns by "accident".
+ // to contain urlencoded patterns by "accident".
$password = urldecode($password);
- foreach ($this->backends as $backend) {
+ foreach ($backends as $backend) {
if ($backend->implementsActions(Backend::CHECK_PASSWORD)) {
$uid = $backend->checkPassword($loginName, $password);
if ($uid !== false) {