diff options
author | Louis <louis@chmn.me> | 2024-09-26 14:56:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-26 14:56:37 +0200 |
commit | c45ed55f959ff54f3ea23dd2ae1a5868a075c9fe (patch) | |
tree | 3e12164bfc33cafb9bae15e2e5b3f3eb85e3d559 /apps | |
parent | 0a568e5b48779d2d5d6f8dfe9cf5969ec9c3779f (diff) | |
parent | 20eb4648357ffb0620e45a982c6afd22e50dfca8 (diff) | |
download | nextcloud-server-c45ed55f959ff54f3ea23dd2ae1a5868a075c9fe.tar.gz nextcloud-server-c45ed55f959ff54f3ea23dd2ae1a5868a075c9fe.zip |
Merge pull request #48359 from nextcloud/artonge/feat/compare_hashed_password_when_updating_global_cred_in_files_external
fix: Use placeholder for external storage password
Diffstat (limited to 'apps')
-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 ca1c9ca2bee..f11dab2785f 100644 --- a/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php +++ b/apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php @@ -19,6 +19,7 @@ use OCP\Security\ICredentialsManager; */ class GlobalAuth extends AuthMechanism { public const CREDENTIALS_IDENTIFIER = 'password::global'; + private const PWD_PLACEHOLDER = '************************'; /** @var ICredentialsManager */ protected $credentialsManager; @@ -41,11 +42,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 |