/**
  * Sending the account password reset link.
  * @return string|\yii\web\Response
  */
 public function actionReset()
 {
     $model = new ReForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->reset()) {
             $email = Content::find()->where(['name' => 'email-pass'])->one();
             if ($email) {
                 $topic = $email->topic;
                 $content = $email->content;
             } else {
                 $topic = Content::PASS_TITLE;
                 $content = Content::PASS_BODY;
             }
             $forum = Config::getInstance()->get('name');
             if (Email::queue($model->getUser()->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['account/password', 'token' => $model->getUser()->password_reset_token], true), Url::to(['account/password', 'token' => $model->getUser()->password_reset_token], true)), $content)), !empty($model->getUser()->id) ? $model->getUser()->id : null)) {
                 Log::info('Password reset link queued', !empty($model->getUser()->id) ? $model->getUser()->id : '', __METHOD__);
                 $this->success('The password reset link has been sent to your e-mail address.');
             } else {
                 Log::error('Error while queuing password reset link', !empty($model->getUser()->id) ? $model->getUser()->id : '', __METHOD__);
                 $this->error('Sorry! There was some error while sending you the password reset link. Contact administrator about this problem.');
             }
             return $this->module->goPodium();
         } else {
             $this->error('Sorry! We can not find the account with that user name or e-mail address.');
         }
     }
     return $this->render('reset', ['model' => $model]);
 }
 /**
  * Sending the account password reset link.
  * @return string|\yii\web\Response
  */
 public function actionReset()
 {
     if (PodiumModule::getInstance()->userComponent == PodiumModule::USER_INHERIT) {
         $this->info(Yii::t('podium/flash', 'Please contact the administrator to reset your account password.'));
         return $this->module->goPodium();
     }
     $model = new ReForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->reset()) {
             $email = Content::find()->where(['name' => 'email-pass'])->limit(1)->one();
             if ($email) {
                 $topic = $email->topic;
                 $content = $email->content;
             } else {
                 $topic = Messages::EMAIL_PASS_TITLE;
                 $content = Messages::EMAIL_PASS_BODY;
             }
             $forum = Config::getInstance()->get('name');
             if (!empty($model->email)) {
                 if (Email::queue($model->user->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['account/password', 'token' => $model->user->password_reset_token], true), Url::to(['account/password', 'token' => $model->user->password_reset_token], true)), $content)), !empty($model->user->id) ? $model->user->id : null)) {
                     Log::info('Password reset link queued', $model->user->id, __METHOD__);
                     $this->success(Yii::t('podium/flash', 'The password reset link has been sent to your e-mail address.'));
                 } else {
                     Log::error('Error while queuing password reset link', $model->user->id, __METHOD__);
                     $this->error(Yii::t('podium/flash', 'Sorry! There was some error while sending you the password reset link. Contact administrator about this problem.'));
                 }
             } else {
                 Log::error('Error while queuing password reset link - no email set', $model->user->id, __METHOD__);
                 $this->error(Yii::t('podium/flash', 'Sorry! There is no e-mail address saved with your account. Contact administrator about resetting password.'));
             }
             return $this->module->goPodium();
         } else {
             $this->error(Yii::t('podium/flash', 'Sorry! We can not find the account with that user name or e-mail address.'));
         }
     }
     return $this->render('reset', ['model' => $model]);
 }
 /**
  * Sending the account password reset link.
  * @return string|\yii\web\Response
  */
 public function actionReset()
 {
     if (PodiumModule::getInstance()->userComponent == PodiumModule::USER_INHERIT) {
         $this->info(Yii::t('podium/flash', 'Please contact the administrator to reset your account password.'));
         return $this->module->goPodium();
     }
     $model = new ReForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->reset()) {
             $email = Content::find()->where(['name' => 'email-pass'])->limit(1)->one();
             if ($email) {
                 $topic = $email->topic;
                 $content = $email->content;
             } else {
                 $topic = '{forum} password reset link';
                 $content = '<p>{forum} Password Reset</p><p>You are receiving this e-mail because someone has started the process of changing the account password at {forum}.<br>If this person is you open the following link in your Internet browser and follow the instructions on screen.</p><p>{link}</p><p>If it was not you just ignore this e-mail.</p><p>Thank you!<br>{forum}</p>';
             }
             $forum = Config::getInstance()->get('name');
             if (!empty($model->email)) {
                 if (Email::queue($model->user->email, str_replace('{forum}', $forum, $topic), str_replace('{forum}', $forum, str_replace('{link}', Html::a(Url::to(['account/password', 'token' => $model->user->password_reset_token], true), Url::to(['account/password', 'token' => $model->user->password_reset_token], true)), $content)), !empty($model->user->id) ? $model->user->id : null)) {
                     Log::info('Password reset link queued', $model->user->id, __METHOD__);
                     $this->success(Yii::t('podium/flash', 'The password reset link has been sent to your e-mail address.'));
                 } else {
                     Log::error('Error while queuing password reset link', $model->user->id, __METHOD__);
                     $this->error(Yii::t('podium/flash', 'Sorry! There was some error while sending you the password reset link. Contact administrator about this problem.'));
                 }
             } else {
                 Log::error('Error while queuing password reset link - no email set', $model->user->id, __METHOD__);
                 $this->error(Yii::t('podium/flash', 'Sorry! There is no e-mail address saved with your account. Contact administrator about resetting password.'));
             }
             return $this->module->goPodium();
         } else {
             $this->error(Yii::t('podium/flash', 'Sorry! We can not find the account with that user name or e-mail address.'));
         }
     }
     return $this->render('reset', ['model' => $model]);
 }