Пример #1
0
 public function testSuccess()
 {
     $user = User::findByEmail('*****@*****.**');
     expect_not($user->isConfirmed());
     $form = new ConfirmEmailForm();
     expect_that($form->validateToken($user->email_confirm_token));
     expect_that($form->confirmEmail());
     $user = User::findByEmail($user->email);
     expect($user->email_confirm_token)->isEmpty();
     expect_that($user->isConfirmed());
 }
Пример #2
0
 public function actionConfirmEmail($token)
 {
     $model = new ConfirmEmailForm();
     if (!$model->validateToken($token)) {
         Yii::$app->session->setFlash('error', Yii::t('app.messages', 'Invalid link for activate account'));
         return $this->goHome();
     }
     if ($model->confirmEmail()) {
         Yii::$app->session->setFlash('success', Yii::t('app.messages', 'Your account is successfully activated'));
     }
     return $this->goHome();
 }