Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
aa3e8160
Commit
aa3e8160
authored
Jul 22, 2013
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #652 advanced app fixes
parent
f1ba923e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
SiteController.php
apps/advanced/frontend/controllers/SiteController.php
+5
-4
passwordResetToken.php
apps/advanced/frontend/views/emails/passwordResetToken.php
+1
-1
No files found.
apps/advanced/frontend/controllers/SiteController.php
View file @
aa3e8160
...
@@ -8,6 +8,7 @@ use common\models\LoginForm;
...
@@ -8,6 +8,7 @@ use common\models\LoginForm;
use
frontend\models\ContactForm
;
use
frontend\models\ContactForm
;
use
common\models\User
;
use
common\models\User
;
use
yii\web\HttpException
;
use
yii\web\HttpException
;
use
yii\helpers\Security
;
class
SiteController
extends
Controller
class
SiteController
extends
Controller
{
{
...
@@ -81,14 +82,14 @@ class SiteController extends Controller
...
@@ -81,14 +82,14 @@ class SiteController extends Controller
$model
=
new
User
();
$model
=
new
User
();
$model
->
scenario
=
'requestPasswordResetToken'
;
$model
->
scenario
=
'requestPasswordResetToken'
;
if
(
$model
->
load
(
$_POST
)
&&
$model
->
validate
())
{
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.'
);
Yii
::
$app
->
getSession
()
->
setFlash
(
'success'
,
'Check your email for further instructions.'
);
$this
->
redirect
(
'index'
);
$this
->
redirect
(
'index'
);
}
else
{
}
else
{
Yii
::
$app
->
getSession
()
->
setFlash
(
'error'
,
'There was an error sending email.'
);
Yii
::
$app
->
getSession
()
->
setFlash
(
'error'
,
'There was an error sending email.'
);
}
}
}
}
$this
->
render
(
'requestPasswordResetToken'
,
array
(
return
$this
->
render
(
'requestPasswordResetToken'
,
array
(
'model'
=>
$model
,
'model'
=>
$model
,
));
));
}
}
...
@@ -110,7 +111,7 @@ class SiteController extends Controller
...
@@ -110,7 +111,7 @@ class SiteController extends Controller
$this
->
redirect
(
'index'
);
$this
->
redirect
(
'index'
);
}
}
$this
->
render
(
'resetPassword'
,
array
(
return
$this
->
render
(
'resetPassword'
,
array
(
'model'
=>
$model
,
'model'
=>
$model
,
));
));
}
}
...
@@ -132,7 +133,7 @@ class SiteController extends Controller
...
@@ -132,7 +133,7 @@ class SiteController extends Controller
$name
=
'=?UTF-8?B?'
.
base64_encode
(
\Yii
::
$app
->
name
.
' robot'
)
.
'?='
;
$name
=
'=?UTF-8?B?'
.
base64_encode
(
\Yii
::
$app
->
name
.
' robot'
)
.
'?='
;
$subject
=
'=?UTF-8?B?'
.
base64_encode
(
'Password reset for '
.
\Yii
::
$app
->
name
)
.
'?='
;
$subject
=
'=?UTF-8?B?'
.
base64_encode
(
'Password reset for '
.
\Yii
::
$app
->
name
)
.
'?='
;
$body
=
$this
->
renderPartial
(
'/emails/passwordResetToken'
,
array
(
$body
=
$this
->
renderPartial
(
'/emails/passwordResetToken'
,
array
(
'user'
=>
$
this
,
'user'
=>
$
user
,
));
));
$headers
=
"From:
$name
<
{
$fromEmail
}
>
\r\n
"
.
$headers
=
"From:
$name
<
{
$fromEmail
}
>
\r\n
"
.
"MIME-Version: 1.0
\r\n
"
.
"MIME-Version: 1.0
\r\n
"
.
...
...
apps/advanced/frontend/views/emails/passwordResetToken.php
View file @
aa3e8160
...
@@ -6,7 +6,7 @@ use yii\helpers\Html;
...
@@ -6,7 +6,7 @@ use yii\helpers\Html;
* @var common\models\User $user;
* @var common\models\User $user;
*/
*/
$resetLink
=
$this
->
context
->
crea
teUrl
(
'site/resetPassword'
,
array
(
'token'
=>
$user
->
password_reset_token
));
$resetLink
=
Yii
::
$app
->
urlManager
->
createAbsolu
teUrl
(
'site/resetPassword'
,
array
(
'token'
=>
$user
->
password_reset_token
));
?>
?>
Hello
<?php
echo
Html
::
encode
(
$user
->
username
)
?>
,
Hello
<?php
echo
Html
::
encode
(
$user
->
username
)
?>
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment