Skip to content

Commit c45ed55

Browse files
authored
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
2 parents 0a568e5 + 20eb464 commit c45ed55

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

apps/files_external/lib/Lib/Auth/Password/GlobalAuth.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
*/
2020
class GlobalAuth extends AuthMechanism {
2121
public const CREDENTIALS_IDENTIFIER = 'password::global';
22+
private const PWD_PLACEHOLDER = '************************';
2223

2324
/** @var ICredentialsManager */
2425
protected $credentialsManager;
@@ -41,11 +42,18 @@ public function getAuth($uid) {
4142
'password' => ''
4243
];
4344
} else {
45+
$auth['password'] = self::PWD_PLACEHOLDER;
4446
return $auth;
4547
}
4648
}
4749

4850
public function saveAuth($uid, $user, $password) {
51+
// Use old password if it has not changed.
52+
if ($password === self::PWD_PLACEHOLDER) {
53+
$auth = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER);
54+
$password = $auth['password'];
55+
}
56+
4957
$this->credentialsManager->store($uid, self::CREDENTIALS_IDENTIFIER, [
5058
'user' => $user,
5159
'password' => $password

0 commit comments

Comments
 (0)