Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
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
ops
jumpserver
Commits
2f439fd4
Unverified
Commit
2f439fd4
authored
Jul 24, 2019
by
BaiJiangJie
Committed by
GitHub
Jul 24, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3024 from jumpserver/dev_bai
[Bugfix] 解决用户登录日志记录错误的问题(coco端登录记录类型为Web)
parents
c929c1a8
f4c835d4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
signals_handlers.py
apps/authentication/signals_handlers.py
+5
-3
No files found.
apps/authentication/signals_handlers.py
View file @
2f439fd4
from
rest_framework.request
import
Request
from
django.http.request
import
QueryDict
from
django.http.request
import
QueryDict
from
django.conf
import
settings
from
django.conf
import
settings
from
django.dispatch
import
receiver
from
django.dispatch
import
receiver
...
@@ -52,14 +53,15 @@ def on_ldap_create_user(sender, user, ldap_user, **kwargs):
...
@@ -52,14 +53,15 @@ def on_ldap_create_user(sender, user, ldap_user, **kwargs):
def
generate_data
(
username
,
request
):
def
generate_data
(
username
,
request
):
if
not
request
.
user
.
is_anonymous
and
request
.
user
.
is_app
:
user_agent
=
request
.
META
.
get
(
'HTTP_USER_AGENT'
,
''
)
if
isinstance
(
request
,
Request
):
login_ip
=
request
.
data
.
get
(
'remote_addr'
,
None
)
login_ip
=
request
.
data
.
get
(
'remote_addr'
,
None
)
login_type
=
request
.
data
.
get
(
'login_type'
,
''
)
login_type
=
request
.
data
.
get
(
'login_type'
,
''
)
user_agent
=
request
.
data
.
get
(
'HTTP_USER_AGENT'
,
''
)
else
:
else
:
login_ip
=
get_request_ip
(
request
)
login_ip
=
get_request_ip
(
request
)
user_agent
=
request
.
META
.
get
(
'HTTP_USER_AGENT'
,
''
)
login_type
=
'W'
login_type
=
'W'
data
=
{
data
=
{
'username'
:
username
,
'username'
:
username
,
'ip'
:
login_ip
,
'ip'
:
login_ip
,
...
...
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