From aa3e8160231697f4046d672c27addfa3ee91801e Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Mon, 22 Jul 2013 12:41:12 +0400 Subject: [PATCH] fixes #652 advanced app fixes --- apps/advanced/frontend/controllers/SiteController.php | 9 +++++---- apps/advanced/frontend/views/emails/passwordResetToken.php | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/advanced/frontend/controllers/SiteController.php b/apps/advanced/frontend/controllers/SiteController.php index 93f161b..285b553 100644 --- a/apps/advanced/frontend/controllers/SiteController.php +++ b/apps/advanced/frontend/controllers/SiteController.php @@ -8,6 +8,7 @@ use common\models\LoginForm; use frontend\models\ContactForm; use common\models\User; use yii\web\HttpException; +use yii\helpers\Security; class SiteController extends Controller { @@ -81,14 +82,14 @@ class SiteController extends Controller $model = new User(); $model->scenario = 'requestPasswordResetToken'; if ($model->load($_POST) && $model->validate()) { - if ($this->sendPasswordResetEmail($email)) { + if ($this->sendPasswordResetEmail($model->email)) { Yii::$app->getSession()->setFlash('success', 'Check your email for further instructions.'); $this->redirect('index'); } else { Yii::$app->getSession()->setFlash('error', 'There was an error sending email.'); } } - $this->render('requestPasswordResetToken', array( + return $this->render('requestPasswordResetToken', array( 'model' => $model, )); } @@ -110,7 +111,7 @@ class SiteController extends Controller $this->redirect('index'); } - $this->render('resetPassword', array( + return $this->render('resetPassword', array( 'model' => $model, )); } @@ -132,7 +133,7 @@ class SiteController extends Controller $name = '=?UTF-8?B?' . base64_encode(\Yii::$app->name . ' robot') . '?='; $subject = '=?UTF-8?B?' . base64_encode('Password reset for ' . \Yii::$app->name) . '?='; $body = $this->renderPartial('/emails/passwordResetToken', array( - 'user' => $this, + 'user' => $user, )); $headers = "From: $name <{$fromEmail}>\r\n" . "MIME-Version: 1.0\r\n" . diff --git a/apps/advanced/frontend/views/emails/passwordResetToken.php b/apps/advanced/frontend/views/emails/passwordResetToken.php index 110bfbf..5ab5df1 100644 --- a/apps/advanced/frontend/views/emails/passwordResetToken.php +++ b/apps/advanced/frontend/views/emails/passwordResetToken.php @@ -6,7 +6,7 @@ use yii\helpers\Html; * @var common\models\User $user; */ -$resetLink = $this->context->createUrl('site/resetPassword', array('token' => $user->password_reset_token)); +$resetLink = Yii::$app->urlManager->createAbsoluteUrl('site/resetPassword', array('token' => $user->password_reset_token)); ?> Hello username)?>,