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
a687e6f5
Commit
a687e6f5
authored
Feb 21, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Validate login data only of there are no other errors
parent
46ca87a4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
LoginForm.php
apps/advanced/common/models/LoginForm.php
+7
-5
LoginForm.php
apps/basic/models/LoginForm.php
+7
-5
No files found.
apps/advanced/common/models/LoginForm.php
View file @
a687e6f5
...
...
@@ -23,10 +23,10 @@ class LoginForm extends Model
return
[
// username and password are both required
[[
'username'
,
'password'
],
'required'
],
// password is validated by validatePassword()
[
'password'
,
'validatePassword'
],
// rememberMe must be a boolean value
[
'rememberMe'
,
'boolean'
],
// password is validated by validatePassword()
[
'password'
,
'validatePassword'
],
];
}
...
...
@@ -36,9 +36,11 @@ class LoginForm extends Model
*/
public
function
validatePassword
()
{
$user
=
$this
->
getUser
();
if
(
!
$user
||
!
$user
->
validatePassword
(
$this
->
password
))
{
$this
->
addError
(
'password'
,
'Incorrect username or password.'
);
if
(
!
$this
->
hasErrors
())
{
$user
=
$this
->
getUser
();
if
(
!
$user
||
!
$user
->
validatePassword
(
$this
->
password
))
{
$this
->
addError
(
'password'
,
'Incorrect username or password.'
);
}
}
}
...
...
apps/basic/models/LoginForm.php
View file @
a687e6f5
...
...
@@ -24,10 +24,10 @@ class LoginForm extends Model
return
[
// username and password are both required
[[
'username'
,
'password'
],
'required'
],
// password is validated by validatePassword()
[
'password'
,
'validatePassword'
],
// rememberMe must be a boolean value
[
'rememberMe'
,
'boolean'
],
// password is validated by validatePassword()
[
'password'
,
'validatePassword'
],
];
}
...
...
@@ -37,10 +37,12 @@ class LoginForm extends Model
*/
public
function
validatePassword
()
{
$user
=
$this
->
getUser
();
if
(
!
$this
->
hasErrors
())
{
$user
=
$this
->
getUser
();
if
(
!
$user
||
!
$user
->
validatePassword
(
$this
->
password
))
{
$this
->
addError
(
'password'
,
'Incorrect username or password.'
);
if
(
!
$user
||
!
$user
->
validatePassword
(
$this
->
password
))
{
$this
->
addError
(
'password'
,
'Incorrect username or password.'
);
}
}
}
...
...
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