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 @@
Welcome, {{name}} to our support center, - your email is {{to}} + your email is {{to}}, + your token is {{verificationToken}}
diff --git a/server/data/mail-templates/user-signup-es.html b/server/data/mail-templates/user-signup-es.html index 8af75ae0..da8e2c84 100644 --- a/server/data/mail-templates/user-signup-es.html +++ b/server/data/mail-templates/user-signup-es.html @@ -1,4 +1,5 @@
Bienvenido, {{name}} a nuestro centro de soporte, - tu email es {{to}} + tu email es {{to}}, + tu codigo de verificacion es {{verificationToken}}
\ No newline at end of file diff --git a/tests/system/edit-settings.rb b/tests/system/edit-settings.rb index 0d9c1d02..f8755345 100644 --- a/tests/system/edit-settings.rb +++ b/tests/system/edit-settings.rb @@ -12,11 +12,7 @@ describe'system/edit-settings' do "allow-attachments" => 1, "max-size" => 2, "language" => 'es', - "no-reply-email" => 'testemail@hotmail.com', - "smtp-host" => 'www.opensupports.com', - "smtp-port" => 18, - "smtp-user" => 'admin', - "smtp-pass" => 'pass1234', + "no-reply-email" => 'testemail@hotmail.com' }) (result['status']).should.equal('success') @@ -39,18 +35,6 @@ describe'system/edit-settings' do row = $database.getRow('setting', 'no-reply-email', 'name') (row['value']).should.equal('testemail@hotmail.com') - row = $database.getRow('setting', 'smtp-host', 'name') - (row['value']).should.equal('www.opensupports.com') - - row = $database.getRow('setting', 'smtp-port', 'name') - (row['value']).should.equal('18') - - row = $database.getRow('setting', 'smtp-user', 'name') - (row['value']).should.equal('admin') - - row = $database.getRow('setting', 'smtp-pass', 'name') - (row['value']).should.equal('pass1234') - request('/user/logout') end end