From b5c4e99cb1a2e5bb5cf6d38192d677843b1acd80 Mon Sep 17 00:00:00 2001 From: winter Date: Thu, 20 Mar 2025 22:17:38 +0000 Subject: fix various htmx navigation / page reloads also i added a UserAccount::setPassword because i felt like it --- Digitigrade/Model/UserAccount.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Digitigrade/Model') diff --git a/Digitigrade/Model/UserAccount.php b/Digitigrade/Model/UserAccount.php index 37e0c7e..a409fe8 100644 --- a/Digitigrade/Model/UserAccount.php +++ b/Digitigrade/Model/UserAccount.php @@ -16,7 +16,7 @@ class UserAccount extends Model { public static function create(string $email, #[\SensitiveParameter] string $password): self { $user = new self(); $user->email = $email; - $user->passwordHash = defaults_password_hash($password); + $user->setPassword($password); $user->actor = null; $user->save(); return $user; @@ -69,6 +69,10 @@ class UserAccount extends Model { return password_verify($attemptedPassword, $this->passwordHash); } + public function setPassword(#[\SensitiveParameter] $newPassword): void { + $this->passwordHash = defaults_password_hash($newPassword); + } + /** * Throws if this user isn't an admin. * @return self this user (so you can use it in chains) -- cgit v1.3