Esempio n. 1
0
 public function actionActivation()
 {
     $activationHash = Yii::$app->request->get(self::HASH_PARAM_NAME);
     $user = User::find()->where(['activation_hash' => $activationHash])->one();
     if (!$user) {
         throw new HttpException(400, Yii::t('app', 'Bad security code'));
     }
     $user->activation_hash = null;
     $complete = $user->save(false);
     $alert = \yii\bootstrap\Alert::widget(['options' => ['class' => 'alert-success'], 'body' => Yii::t('app', 'Activation finished successfully. You can log in now')]);
     if ($complete) {
         Yii::$app->getSession()->setFlash('successActivation', $alert);
     }
     return $this->render('activation', []);
 }