diff options
author | emkael <emkael@tlen.pl> | 2017-03-15 16:36:16 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2017-03-15 16:47:25 +0100 |
commit | f70a6798f14773faefea6628927d9240940a6f26 (patch) | |
tree | a8993536bf9a734f6982775ab4129969da05f0ec /app/frontend/facades/UserFacade.php | |
parent | 917a2dde09925199f9000b35e74fecb67af326ec (diff) |
* activation landing page
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( |