aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade
diff options
context:
space:
mode:
Diffstat (limited to 'Digitigrade')
-rw-r--r--Digitigrade/Model/UserAccount.php6
1 files changed, 5 insertions, 1 deletions
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)