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
d0ba0503
Commit
d0ba0503
authored
Feb 25, 2016
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #81 from jumpserver/v3.0_beta_issue_62
V3.0 beta issue 62 用户下载key后,就删除,为了安全
parents
f79675b2
27be35ae
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
views.py
juser/views.py
+2
-1
user_list.html
templates/juser/user_list.html
+10
-1
No files found.
juser/views.py
View file @
d0ba0503
...
@@ -452,7 +452,6 @@ def down_key(request):
...
@@ -452,7 +452,6 @@ def down_key(request):
uuid_r
=
request
.
GET
.
get
(
'uuid'
,
''
)
uuid_r
=
request
.
GET
.
get
(
'uuid'
,
''
)
else
:
else
:
uuid_r
=
request
.
user
.
uuid
uuid_r
=
request
.
user
.
uuid
if
uuid_r
:
if
uuid_r
:
user
=
get_object
(
User
,
uuid
=
uuid_r
)
user
=
get_object
(
User
,
uuid
=
uuid_r
)
if
user
:
if
user
:
...
@@ -465,6 +464,8 @@ def down_key(request):
...
@@ -465,6 +464,8 @@ def down_key(request):
f
.
close
()
f
.
close
()
response
=
HttpResponse
(
data
,
content_type
=
'application/octet-stream'
)
response
=
HttpResponse
(
data
,
content_type
=
'application/octet-stream'
)
response
[
'Content-Disposition'
]
=
'attachment; filename=
%
s'
%
os
.
path
.
basename
(
private_key_file
)
response
[
'Content-Disposition'
]
=
'attachment; filename=
%
s'
%
os
.
path
.
basename
(
private_key_file
)
if
request
.
user
.
role
==
'CU'
:
os
.
unlink
(
private_key_file
)
return
response
return
response
return
HttpResponse
(
'No Key File. Contact Admin.'
)
return
HttpResponse
(
'No Key File. Contact Admin.'
)
templates/juser/user_list.html
View file @
d0ba0503
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
{% if user.username|key_exist %}
{% if user.username|key_exist %}
<a
href=
"{% url 'key_down' %}?uuid={{ user.uuid }}"
>
下载
</a>
<a
href=
"{% url 'key_down' %}?uuid={{ user.uuid }}"
>
下载
</a>
{% else %}
{% else %}
<
span
style=
"color: #586b7d"
>
NoKey
</span
>
<
a
href=
"#"
onclick=
"genSSH('{{ user.username }}','{% url 'key_gen' %}?uuid={{ user.uuid }}')"
>
NoKey GenOne?
</a
>
{% endif %}
{% endif %}
</td>
</td>
<td
class=
"text-center"
>
<td
class=
"text-center"
>
...
@@ -150,5 +150,13 @@
...
@@ -150,5 +150,13 @@
});
});
$
(
'.shiftCheckbox'
).
shiftcheckbox
();
$
(
'.shiftCheckbox'
).
shiftcheckbox
();
});
});
function
genSSH
(
username
,
url
)
{
if
(
confirm
(
'Are you sure to gen a sshkey for user '
+
username
))
{
$
.
get
(
url
,
function
(
data
)
{
alert
(
data
);
location
.
reload
()
})
}
}
</script>
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
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