diff --git a/server/controllers/user/get-user.php b/server/controllers/user/get-user.php index 5f9e3059..8ea55c09 100644 --- a/server/controllers/user/get-user.php +++ b/server/controllers/user/get-user.php @@ -34,7 +34,8 @@ class GetUserByIdController extends Controller { 'name' => $user->name, 'email' => $user->email, 'signupDate' => $user->signupDate, - 'tickets' => $tickets->toArray() + 'tickets' => $tickets->toArray(), + 'verified' => !$user->verificationToken ]); } } \ No newline at end of file diff --git a/server/controllers/user/signup.php b/server/controllers/user/signup.php index 9c642d11..baca69b4 100644 --- a/server/controllers/user/signup.php +++ b/server/controllers/user/signup.php @@ -9,6 +9,7 @@ class SignUpController extends Controller { private $userEmail; private $userName; private $userPassword; + private $verificationToken; public function validations() { return [ @@ -64,20 +65,19 @@ class SignUpController extends Controller { $this->userName = Controller::request('name'); $this->userEmail = Controller::request('email'); $this->userPassword = Controller::request('password'); + $this->verificationToken = Hashing::generateRandomToken(); } public function createNewUserAndRetrieveId() { $userInstance = new User(); - $token = Hashing::generateRandomToken(); - $userInstance->setProperties([ 'name' => $this->userName, 'signupDate' => Date::getCurrentDate(), 'tickets' => 0, 'email' => $this->userEmail, 'password' => Hashing::hashPassword($this->userPassword), - 'verificationToken' => $token + 'verificationToken' => $this->verificationToken ]); return $userInstance->store(); @@ -88,7 +88,8 @@ class SignUpController extends Controller { $mailSender->setTemplate(MailTemplate::USER_SIGNUP, [ 'to' => $this->userEmail, - 'name' => $this->userName + 'name' => $this->userName, + 'verificationToken' => $this->verificationToken ]); $mailSender->send(); diff --git a/server/data/mail-templates/user-signup-en.html b/server/data/mail-templates/user-signup-en.html index 371a2441..66a0219a 100644 --- a/server/data/mail-templates/user-signup-en.html +++ b/server/data/mail-templates/user-signup-en.html @@ -1,4 +1,5 @@