diff options
author | Louis Chemineau <louis@chmn.me> | 2024-09-24 16:20:04 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2024-09-26 13:03:28 +0000 |
commit | fa12da0ce75d28cc421f5ffd8f55ef73bd94c551 (patch) | |
tree | 92f90ad94d0b1df57f1b81634e87878ed6423aa2 | |
parent | 56a734b47f974f7ce078853122ddc2f911b23dbe (diff) | |
download | nextcloud-server-backport/48359/stable29.tar.gz nextcloud-server-backport/48359/stable29.zip |
fix: Use hashed password in files_external settingsbackport/48359/stable29
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r-- | apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php index 174efd96e3c..278eab55ced 100644 --- a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php +++ b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php @@ -37,6 +37,7 @@ use OCP\Security\ICredentialsManager; */ class GlobalAuth extends AuthMechanism { public const CREDENTIALS_IDENTIFIER = 'password::global'; + private const PWD_PLACEHOLDER = '************************'; /** @var ICredentialsManager */ protected $credentialsManager; @@ -59,11 +60,18 @@ class GlobalAuth extends AuthMechanism { 'password' => '' ]; } else { + $auth['password'] = self::PWD_PLACEHOLDER; return $auth; } } public function saveAuth($uid, $user, $password) { + // Use old password if it has not changed. + if ($password === self::PWD_PLACEHOLDER) { + $auth = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER); + $password = $auth['password']; + } + $this->credentialsManager->store($uid, self::CREDENTIALS_IDENTIFIER, [ 'user' => $user, 'password' => $password |