From f70a6798f14773faefea6628927d9240940a6f26 Mon Sep 17 00:00:00 2001 From: emkael Date: Wed, 15 Mar 2017 16:36:16 +0100 Subject: * activation landing page --- app/frontend/facades/UserFacade.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/frontend/facades/UserFacade.php') 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( -- cgit v1.2.3