diff options
author | Julius Knorr <jus@bitgrid.net> | 2025-03-07 16:49:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-07 16:49:18 +0100 |
commit | bb6b4626908b00faf4c0a37417b0a22fb76a7ab2 (patch) | |
tree | dc91fdc9084944b5aea49699137d57b5654a3dae /lib/private/Authentication | |
parent | 49e52c1779ac4bf1f632b78a8328e8e6401bd98f (diff) | |
parent | 777cd941dc1bf7009bbb8465afd907c75b4d2d7b (diff) | |
download | nextcloud-server-bb6b4626908b00faf4c0a37417b0a22fb76a7ab2.tar.gz nextcloud-server-bb6b4626908b00faf4c0a37417b0a22fb76a7ab2.zip |
Merge pull request #51130 from nextcloud/fix/credential-passwordless-auth
fix: Do not build encrypted password if there is none
Diffstat (limited to 'lib/private/Authentication')
-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'], |