Skip to content

Commit 1ee9f58

Browse files
artongebackportbot[bot]
authored andcommitted
fix: Use hashed password in files_external settings
Signed-off-by: Louis Chemineau <[email protected]>
1 parent cdc954d commit 1ee9f58

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
*/
3838
class GlobalAuth extends AuthMechanism {
3939
public const CREDENTIALS_IDENTIFIER = 'password::global';
40+
private const PWD_PLACEHOLDER = '************************';
4041

4142
/** @var ICredentialsManager */
4243
protected $credentialsManager;
@@ -59,11 +60,18 @@ public function getAuth($uid) {
5960
'password' => ''
6061
];
6162
} else {
63+
$auth['password'] = self::PWD_PLACEHOLDER;
6264
return $auth;
6365
}
6466
}
6567

6668
public function saveAuth($uid, $user, $password) {
69+
// Use old password if it has not changed.
70+
if ($password === self::PWD_PLACEHOLDER) {
71+
$auth = $this->credentialsManager->retrieve($uid, self::CREDENTIALS_IDENTIFIER);
72+
$password = $auth['password'];
73+
}
74+
6775
$this->credentialsManager->store($uid, self::CREDENTIALS_IDENTIFIER, [
6876
'user' => $user,
6977
'password' => $password

0 commit comments

Comments
 (0)