This action only handle requests and redirect back. No render
{
if (Yii::app()->user->isGuest) {
if (isset($_POST['UserRecoveryForm'])) {
$form->attributes = $_POST['UserRecoveryForm'];
if ($form->validate()) {
$user =
User::model()->with(
'account')->notsafe()->findbyPk($form->user_id);
if ($user->account) {
Yii::app()->user->setFlash(
'recoveryMessage',
UserModule::t(
"You used TPA for logged in. You can not recovery password"));
} else {
$activation_url = $this->_getChangePasswordUrl(array("activkey" => $user->activkey, "email" => $user->email));
$subject =
UserModule::t(
"You have requested the password recovery site {site_name}",
array(
'{site_name}' => Yii::app()->name,
));
$message = $this->renderMail('/mail_templates/recovery', $subject, array('activation_url' => $activation_url));
$subject,
$message,
array(
new EmailRecipient($user->email, $this->module->passwordForgottenEmail,
'',
true))
);
Yii::app()->notificationManager->notifyAbout($notification);
Yii::app()->user->setFlash(
'recoveryMessage',
UserModule::t(
"Please check your email. An instruction was sent to your email address."));
}
} else {
$form->password = null;
$form->verifyPassword = null;
Yii::app()->user->setState('UserRecoveryForm', array('attributes' => $form->attributes, 'errors' => $form->getErrors()));
}
}
} else {
Yii::app()->user->setFlash(
'recoveryMessage',
UserModule::t(
"Please log out."));
}
if (isset($_REQUEST['return_url'])) {
$this->redirect($_REQUEST['return_url']);
} else {
$this->render('recovery', array('form' => $form));
}
}