Glad I caught that early on, oof.

This commit is contained in:
flash 2018-03-10 17:02:44 +01:00
parent 25ac3e4bac
commit c4222eed71

View file

@ -94,12 +94,18 @@ class User extends Model
public function validatePassword(string $password): bool public function validatePassword(string $password): bool
{ {
$verification = password_verify($password, $this->password);
if ($verification !== true) {
return false;
}
if (password_needs_rehash($this->password, self::PASSWORD_HASH_ALGO)) { if (password_needs_rehash($this->password, self::PASSWORD_HASH_ALGO)) {
$this->password = $password; $this->password = $password;
$this->save(); $this->save();
} }
return password_verify($password, $this->password); return true;
} }
public function getDisplayRoleAttribute(?int $value): int public function getDisplayRoleAttribute(?int $value): int