/** * 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]); } }
/** * 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'); }