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
f53cf8d5
Commit
f53cf8d5
authored
Nov 11, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复用户登陆工单
parent
aeff0ab5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
11 deletions
+36
-11
login_confirm.py
apps/authentication/api/login_confirm.py
+1
-0
errors.py
apps/authentication/errors.py
+1
-1
mixins.py
apps/authentication/mixins.py
+1
-1
login_wait_confirm.html
...tication/templates/authentication/login_wait_confirm.html
+32
-8
login.py
apps/authentication/views/login.py
+1
-1
No files found.
apps/authentication/api/login_confirm.py
View file @
f53cf8d5
...
...
@@ -54,5 +54,6 @@ class LoginConfirmTicketStatusApi(mixins.AuthMixin, APIView):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
ticket
=
self
.
get_ticket
()
if
ticket
:
request
.
session
.
pop
(
'auth_ticket_id'
,
''
)
ticket
.
perform_status
(
'closed'
,
request
.
user
)
return
Response
(
''
,
status
=
200
)
apps/authentication/errors.py
View file @
f53cf8d5
...
...
@@ -138,7 +138,7 @@ class NeedMoreInfoError(Exception):
if
error
:
self
.
error
=
error
if
msg
:
self
.
msg
=
''
self
.
msg
=
msg
def
as_data
(
self
):
return
{
...
...
apps/authentication/mixins.py
View file @
f53cf8d5
...
...
@@ -115,7 +115,7 @@ class AuthMixin:
def
get_ticket_or_create
(
self
,
confirm_setting
):
ticket
=
self
.
get_ticket
()
if
not
ticket
:
if
not
ticket
or
ticket
.
status
==
ticket
.
STATUS_CLOSED
:
ticket
=
confirm_setting
.
create_confirm_ticket
(
self
.
request
)
self
.
request
.
session
[
'auth_ticket_id'
]
=
str
(
ticket
.
id
)
return
ticket
...
...
apps/authentication/templates/authentication/login_wait_confirm.html
View file @
f53cf8d5
...
...
@@ -37,18 +37,18 @@
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-
lg
-3"
>
<div
class=
"col-
sm
-3"
>
<a
class=
"btn btn-primary btn-sm block btn-refresh"
>
<i
class=
"fa fa-refresh"
></i>
{% trans 'Refresh' %}
</a>
</div>
<div
class=
"col-
lg
-3"
>
<div
class=
"col-
sm
-3"
>
<a
class=
"btn btn-primary btn-sm block btn-copy"
data-link=
"{{ ticket_detail_url }}"
>
<i
class=
"fa fa-clipboard"
></i>
{% trans 'Copy link' %}
</a>
</div>
<div
class=
"col-
lg
-3"
>
<a
class=
"btn btn-default btn-sm block btn-return"
href=
"{% url 'authentication:login' %}"
>
<div
class=
"col-
sm
-3"
>
<a
class=
"btn btn-default btn-sm block btn-return"
>
<i
class=
"fa fa-reply"
></i>
{% trans 'Return' %}
</a>
</div>
...
...
@@ -82,6 +82,7 @@ function doRequestAuth() {
method
:
"GET"
,
success
:
function
(
data
)
{
if
(
!
data
.
error
&&
data
.
msg
===
'ok'
)
{
window
.
onbeforeunload
=
function
(){};
window
.
location
=
"{% url 'authentication:login-guard' %}"
}
else
if
(
data
.
error
!==
"login_confirm_wait"
)
{
if
(
!
errorMsgShow
)
{
...
...
@@ -125,17 +126,40 @@ function handleProgressBar() {
progressBarRef
.
attr
(
'aria-valuenow'
,
offset
);
}
function
cancelLoginConfirmTicket
()
{
requestApi
({
url
:
url
,
method
:
"DELETE"
,
flash_message
:
false
})
}
function
cancelCloseConfirm
()
{
window
.
onbeforeunload
=
function
()
{};
window
.
onunload
=
function
(){};
}
function
setCloseConfirm
()
{
window
.
onbeforeunload
=
function
(
e
)
{
return
'Confirm'
;
};
window
.
onunload
=
function
(
e
)
{
cancelLoginConfirmTicket
();
}
}
$
(
document
).
ready
(
function
()
{
interval
=
setInterval
(
handleProgressBar
,
1000
);
checkInterval
=
setInterval
(
doRequestAuth
,
5000
);
doRequestAuth
();
initClipboard
();
window
.
onbeforeunload
=
function
(
e
)
{
return
"{% trans "
Confirm
" %}"
;
};
setCloseConfirm
();
}).
on
(
'click'
,
'.btn-refresh'
,
function
()
{
window
.
onbeforeunload
=
function
()
{}
;
cancelCloseConfirm
()
;
window
.
location
.
reload
();
}).
on
(
'click'
,
'.btn-return'
,
function
()
{
cancelCloseConfirm
();
window
.
location
=
"{% url 'authentication:login' %}"
})
</script>
...
...
apps/authentication/views/login.py
View file @
f53cf8d5
...
...
@@ -152,8 +152,8 @@ class UserLoginWaitConfirmView(TemplateView):
ticket
=
get_object_or_none
(
LoginConfirmTicket
,
pk
=
ticket_id
)
context
=
super
()
.
get_context_data
(
**
kwargs
)
if
ticket
:
ticket_detail_url
=
reverse
(
'tickets:login-confirm-ticket-detail'
,
kwargs
=
{
'pk'
:
ticket_id
})
timestamp_created
=
datetime
.
datetime
.
timestamp
(
ticket
.
date_created
)
ticket_detail_url
=
reverse
(
'tickets:login-confirm-ticket-detail'
,
kwargs
=
{
'pk'
:
ticket_id
})
msg
=
_
(
"""Wait for <b>{}</b> confirm, You also can copy link to her/him <br/>
Don't close this page"""
)
.
format
(
ticket
.
assignees_display
)
else
:
...
...
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