mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
Fix: validator not working
This commit is contained in:
parent
f6b04ae63e
commit
cbc8b2ca0d
1 changed files with 4 additions and 3 deletions
|
|
@ -115,9 +115,10 @@ function createUser(Hash $hash, string $userId, ?string $email, ?string $passwor
|
|||
$emailCanonical = null;
|
||||
}
|
||||
$hashedPassword = null;
|
||||
|
||||
|
||||
$isHashed = !$hash instanceof Plaintext;
|
||||
if (!empty($password)) {
|
||||
if ($hash instanceof Plaintext) { // Password was never hashed, hash it with the default hash
|
||||
if (!$isHashed) { // Password was never hashed, hash it with the default hash
|
||||
$defaultHash = new ProofsPassword();
|
||||
$hashedPassword = $defaultHash->hash($password);
|
||||
$hash = $defaultHash->getHash();
|
||||
|
|
@ -159,7 +160,7 @@ function createUser(Hash $hash, string $userId, ?string $email, ?string $passwor
|
|||
'emailIsFree' => $emailCanonical?->isFree(),
|
||||
]);
|
||||
|
||||
if ($hash instanceof Plaintext) {
|
||||
if (!$isHashed) {
|
||||
$hooks->trigger('passwordValidator', [$dbForProject, $project, $plaintextPassword, &$user, true]);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue