Example #1
0
 /**
  * Renders the exception.
  * @param \Exception $exception the exception to be rendered.
  */
 protected function renderException($exception)
 {
     // debug info ----------------------------------------------------------
     \common\helpers\AppDebug::dump(['method' => __METHOD__, 'line' => __LINE__, 'exception' => $this->htmlEncode($this->convertExceptionToString($exception)), 'module' => AppHelper::getModuleName(), 'controller' => AppHelper::getControllerName(), 'action' => AppHelper::getActionName(), 'route' => AppHelper::getRoute(), 'clientIp' => AppHelper::getClientIp()]);
     // ---------------------------------------------------------------------
     parent::renderException($exception);
 }
Example #2
0
 /**
  * Displays the contact static page and sends the contact email.
  *
  * @return string|\yii\web\Response
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->contact(Yii::$app->params['adminEmail'])) {
             AppHelper::showSuccessMessage(Yii::t('site', 'Thank you for contacting us. We will respond to you as soon as possible.'));
         } else {
             AppHelper::showSuccessMessage(Yii::t('site', 'There was an error sending email.'));
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Example #3
0
 /**
  * Activates the user profile so he can log in into system.
  *
  * @param  string $token
  * @return \yii\web\Response
  *
  * @throws BadRequestHttpException
  */
 public function actionActivateProfile($token)
 {
     try {
         $user = new ProfileActivation($token);
     } catch (InvalidParamException $e) {
         throw new BadRequestHttpException($e->getMessage());
     }
     if ($user->activateProfile()) {
         AppHelper::showSuccessMessage(Yii::t('frontend-profile', 'Success! You can now log in.') . ' ' . Yii::t('frontend-profile', 'Thank you {user} for joining us!', ['user' => Html::encode($user->username)]));
     } else {
         AppHelper::showErrorMessage(Yii::t('frontend-profile', 'Sorry, {user} your profile could not be activated, please contact us!', ['user' => Html::encode($user->username)]));
     }
     return $this->redirect('/login');
 }
Example #4
0
 /**
  * Returns current action name
  *
  * @return string
  */
 public function getActionName()
 {
     return AppHelper::getActionName();
 }