mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
fix: Use hashed password in files_external settings
Signed-off-by: Louis Chemineau <louis@chmn.me>
This commit is contained in:
parent
a04eb936b1
commit
ef01b1e1cd
1 changed files with 8 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue