diff options
Diffstat (limited to 'app/frontend/facades/UserFacade.php')
-rw-r--r-- | app/frontend/facades/UserFacade.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/frontend/facades/UserFacade.php b/app/frontend/facades/UserFacade.php index 6a7feac..9c1d5d8 100644 --- a/app/frontend/facades/UserFacade.php +++ b/app/frontend/facades/UserFacade.php @@ -55,6 +55,22 @@ class UserFacade extends Facade { return password_verify($password, $dbPassword); } + public function activateUser(string $email, string $hash) { + $user = $this->findByEMail( + base64_decode($email) + ); + $activation = $user && !$user->IsActive + && ($user->ActivationHash === $hash); + if ($activation) { + $user->IsActive = TRUE; + $user->ActivationDate = date('Y-m-d H:i:s'); + $user->ActivationHash = NULL; + $user->save(); + return TRUE; + } + return FALSE; + } + public function setTimezonePreference(DbUser $user, string $timezone) { if ($user->IsGuest) { throw new TInvalidDataException( |