14 $this->redirect(Yii::app()->controller->module->returnUrl);
16 $email = ((isset($_GET[
'email'])) ? $_GET[
'email'] :
'');
17 $activkey = ((isset($_GET[
'activkey'])) ? $_GET[
'activkey'] :
'');
18 if ($email && $activkey) {
20 $find =
User::model()->notsafe()->findByAttributes(array(
'email' => $email));
21 if (isset($find) && $find->activkey == $activkey) {
22 if (isset($_POST[
'UserChangePassword'])) {
23 $form2->attributes = $_POST[
'UserChangePassword'];
24 if ($form2->validate()) {
25 $find->password = Yii::app()->controller->module->encrypting($form2->password);
26 $find->activkey = Yii::app()->controller->module->encrypting(microtime().$form2->password);
27 if ($find->status == 0) {
31 Yii::app()->user->setFlash(
'recoveryMessage',
UserModule::t(
"New password is saved."));
32 $this->redirect(Yii::app()->controller->module->recoveryUrl);
35 $this->render(
'changepassword', array(
'form' => $form2));
37 Yii::app()->user->setFlash(
'recoveryMessage',
UserModule::t(
"Incorrect recovery link."));
38 $this->redirect(Yii::app()->controller->module->recoveryUrl);
41 if (isset($_POST[
'UserRecoveryForm'])) {
42 $form->attributes = $_POST[
'UserRecoveryForm'];
43 if (
$form->validate()) {
45 $activation_url =
'http://'.$_SERVER[
'HTTP_HOST'].$this->createUrl(implode(Yii::app()->controller->module->recoveryUrl), array(
"activkey" => $user->activkey,
"email" => $user->email));
47 $subject =
UserModule::t(
"You have requested the password recovery site {site_name}",
49 '{site_name}' => Yii::app()->name,
51 $message =
UserModule::t(
"You have requested the password recovery site {site_name}. To receive a new password, go to {activation_url}.",
53 '{site_name}' => Yii::app()->name,
54 '{activation_url}' => $activation_url,
59 Yii::app()->user->setFlash(
'recoveryMessage',
UserModule::t(
"Please check your email. An instructions was sent to your email address."));
63 $this->render(
'recovery', array(
'form' =>
$form));