diff options
author | Andy Scherzinger <info@andy-scherzinger.de> | 2025-03-28 16:19:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-28 16:19:52 +0100 |
commit | 5ebcf9b72b174da31cc2ee5cd231a4935ff78ec4 (patch) | |
tree | 0648b08ac8f8624ff8f2173a56a270bcc4dccd74 /lib | |
parent | 0b2bd3b6155df8937648437b7e9f0b648072788e (diff) | |
parent | ebe943207d55296e701d29ee17c6bb000de54e50 (diff) | |
download | nextcloud-server-5ebcf9b72b174da31cc2ee5cd231a4935ff78ec4.tar.gz nextcloud-server-5ebcf9b72b174da31cc2ee5cd231a4935ff78ec4.zip |
Merge pull request #51327 from nextcloud/backport/51130/stable30
[stable30] fix: Do not build encrypted password if there is none
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Authentication/LoginCredentials/Store.php | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/private/Authentication/LoginCredentials/Store.php b/lib/private/Authentication/LoginCredentials/Store.php index b6f22ce345f..67c5712715c 100644 --- a/lib/private/Authentication/LoginCredentials/Store.php +++ b/lib/private/Authentication/LoginCredentials/Store.php @@ -50,7 +50,9 @@ class Store implements IStore { * @param array $params */ public function authenticate(array $params) { - $params['password'] = $this->crypto->encrypt((string)$params['password']); + if ($params['password'] !== null) { + $params['password'] = $this->crypto->encrypt((string)$params['password']); + } $this->session->set('login_credentials', json_encode($params)); } @@ -97,10 +99,12 @@ class Store implements IStore { if ($trySession && $this->session->exists('login_credentials')) { /** @var array $creds */ $creds = json_decode($this->session->get('login_credentials'), true); - try { - $creds['password'] = $this->crypto->decrypt($creds['password']); - } catch (Exception $e) { - //decryption failed, continue with old password as it is + if ($creds['password'] !== null) { + try { + $creds['password'] = $this->crypto->decrypt($creds['password']); + } catch (Exception $e) { + //decryption failed, continue with old password as it is + } } return new Credentials( $creds['uid'], |