8000 Fix: validator not working · appwrite/appwrite@cbc8b2c · GitHub
[go: up one dir, main page]

Skip to content

Commit cbc8b2c

Browse files
committed
Fix: validator not working
1 parent f6b04ae commit cbc8b2c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

app/controllers/api/users.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,10 @@ function createUser(Hash $hash, string $userId, ?string $email, ?string $passwor
115115
$emailCanonical = null;
116116
}
117117
$hashedPassword = null;
118-
118+
119+
$isHashed = !$hash instanceof Plaintext;
119120
if (!empty($password)) {
120-
if ($hash instanceof Plaintext) { // Password was never hashed, hash it with the default hash
121+
if (!$isHashed) { // Password was never hashed, hash it with the default hash
121122
$defaultHash = new ProofsPassword();
122123
$hashedPassword = $defaultHash->hash($password);
123124
$hash = $defaultHash->getHash();
@@ -159,7 +160,7 @@ function createUser(Hash $hash, string $userId, ?string $email, ?string $passwor
159160
'emailIsFree' => $emailCanonical?->isFree(),
160161
]);
161162

162-
if ($hash instanceof Plaintext) {
163+
if (!$isHashed) {
163164
$hooks->trigger('passwordValidator', [$dbForProject, $project, $plaintextPassword, &$user, true]);
164165
}
165166

0 commit comments

Comments
 (0)
0