Exemplo n.º 1
0
 /**
  * Activating new email address based on the provided token.
  * @param string $token
  * @return \yii\web\Response
  */
 public function actionNewEmail($token)
 {
     $model = User::findByEmailToken($token);
     if ($model) {
         $model->setScenario('token');
         if ($model->changeEmail()) {
             Log::info('Email address changed', $model->id, __METHOD__);
             $this->success(Yii::t('podium/flash', 'Your new e-mail address has been activated.'));
         } else {
             Log::error('Error while activating email', $model->id, __METHOD__);
             $this->error(Yii::t('podium/flash', 'Sorry! There was some error while activating your new e-mail address. Contact administrator about this problem.'));
         }
         return $this->module->goPodium();
     } else {
         $this->error(Yii::t('podium/flash', 'The provided activation token is invalid or expired.'));
         return $this->module->goPodium();
     }
 }