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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
342a9a2e
Commit
342a9a2e
authored
Nov 11, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added log messages to user login and logout actions.
parent
23573968
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
User.php
framework/yii/web/User.php
+8
-0
No files found.
framework/yii/web/User.php
View file @
342a9a2e
...
@@ -180,6 +180,9 @@ class User extends Component
...
@@ -180,6 +180,9 @@ class User extends Component
{
{
if
(
$this
->
beforeLogin
(
$identity
,
false
))
{
if
(
$this
->
beforeLogin
(
$identity
,
false
))
{
$this
->
switchIdentity
(
$identity
,
$duration
);
$this
->
switchIdentity
(
$identity
,
$duration
);
$id
=
$identity
->
getId
();
$ip
=
Yii
::
$app
->
getRequest
()
->
getUserIP
();
Yii
::
info
(
"User '
$id
' logged in from
$ip
."
,
__METHOD__
);
$this
->
afterLogin
(
$identity
,
false
);
$this
->
afterLogin
(
$identity
,
false
);
}
}
return
!
$this
->
getIsGuest
();
return
!
$this
->
getIsGuest
();
...
@@ -205,6 +208,8 @@ class User extends Component
...
@@ -205,6 +208,8 @@ class User extends Component
if
(
$identity
!==
null
&&
$identity
->
validateAuthKey
(
$authKey
))
{
if
(
$identity
!==
null
&&
$identity
->
validateAuthKey
(
$authKey
))
{
if
(
$this
->
beforeLogin
(
$identity
,
true
))
{
if
(
$this
->
beforeLogin
(
$identity
,
true
))
{
$this
->
switchIdentity
(
$identity
,
$this
->
autoRenewCookie
?
$duration
:
0
);
$this
->
switchIdentity
(
$identity
,
$this
->
autoRenewCookie
?
$duration
:
0
);
$ip
=
Yii
::
$app
->
getRequest
()
->
getUserIP
();
Yii
::
info
(
"User '
$id
' logged in from
$ip
via cookie."
,
__METHOD__
);
$this
->
afterLogin
(
$identity
,
true
);
$this
->
afterLogin
(
$identity
,
true
);
}
}
}
elseif
(
$identity
!==
null
)
{
}
elseif
(
$identity
!==
null
)
{
...
@@ -225,6 +230,9 @@ class User extends Component
...
@@ -225,6 +230,9 @@ class User extends Component
$identity
=
$this
->
getIdentity
();
$identity
=
$this
->
getIdentity
();
if
(
$identity
!==
null
&&
$this
->
beforeLogout
(
$identity
))
{
if
(
$identity
!==
null
&&
$this
->
beforeLogout
(
$identity
))
{
$this
->
switchIdentity
(
null
);
$this
->
switchIdentity
(
null
);
$id
=
$identity
->
getId
();
$ip
=
Yii
::
$app
->
getRequest
()
->
getUserIP
();
Yii
::
info
(
"User '
$id
' logged out from
$ip
."
,
__METHOD__
);
if
(
$destroySession
)
{
if
(
$destroySession
)
{
Yii
::
$app
->
getSession
()
->
destroy
();
Yii
::
$app
->
getSession
()
->
destroy
();
}
}
...
...
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