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
d0af8eba
Commit
d0af8eba
authored
Jan 02, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of github.com:jumpserver/jumpserver into dev
parents
b2a8415f
560df502
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
58 additions
and
20 deletions
+58
-20
django.po
apps/locale/zh/LC_MESSAGES/django.po
+0
-0
command_execution_create.html
apps/ops/templates/ops/command_execution_create.html
+0
-1
session_list.html
apps/terminal/templates/terminal/session_list.html
+3
-3
user.py
apps/users/models/user.py
+8
-1
user_detail.html
apps/users/templates/users/user_detail.html
+2
-0
user_profile.html
apps/users/templates/users/user_profile.html
+10
-8
user_update.html
apps/users/templates/users/user_update.html
+25
-6
login.py
apps/users/views/login.py
+4
-1
user.py
apps/users/views/user.py
+6
-0
No files found.
apps/locale/zh/LC_MESSAGES/django.po
View file @
d0af8eba
This diff is collapsed.
Click to expand it.
apps/ops/templates/ops/command_execution_create.html
View file @
d0af8eba
...
...
@@ -265,7 +265,6 @@ $(document).ready(function(){
systemUserId
=
$
(
'#system-users-select'
).
val
();
$
(
".select2"
).
select2
({
dropdownAutoWidth
:
true
,
width
:
'auto'
}).
on
(
'select2:select'
,
function
(
evt
)
{
var
data
=
evt
.
params
.
data
;
systemUserId
=
data
.
id
;
...
...
apps/terminal/templates/terminal/session_list.html
View file @
d0af8eba
...
...
@@ -104,10 +104,10 @@
<a
onclick=
"window.open('/luna/replay/{{ session.id }}','luna', 'height=600, width=800, top=400, left=400, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')"
class=
"btn btn-xs btn-warning btn-replay"
>
{% trans "Replay" %}
</a>
{% else %}
<!--<a onclick="window.open('/luna/monitor/{{ session.id }}','luna', 'height=600, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')" class="btn btn-xs btn-warning btn-monitor" >{% trans "Monitor" %}</a>-->
{% if session.protocol == 'rdp' %}
<a
class=
"btn btn-xs btn-danger btn-term"
disabled
value=
"{{ session.id }}"
terminal=
"{{ session.terminal.id }}"
>
{% trans "Terminate" %}
</a>
{% else %}
{% if session.protocol == 'ssh' %}
<a
class=
"btn btn-xs btn-danger btn-term"
value=
"{{ session.id }}"
terminal=
"{{ session.terminal.id }}"
>
{% trans "Terminate" %}
</a>
{% else %}
<a
class=
"btn btn-xs btn-danger btn-term"
disabled
value=
"{{ session.id }}"
terminal=
"{{ session.terminal.id }}"
>
{% trans "Terminate" %}
</a>
{% endif %}
{% endif %}
</td>
...
...
apps/users/models/user.py
View file @
d0af8eba
...
...
@@ -120,7 +120,14 @@ class User(AbstractUser):
def
set_password
(
self
,
raw_password
):
self
.
_set_password
=
True
return
super
()
.
set_password
(
raw_password
)
if
self
.
can_update_password
():
return
super
()
.
set_password
(
raw_password
)
else
:
error
=
_
(
"User auth from {}, go there change password"
)
.
format
(
self
.
source
)
raise
PermissionError
(
error
)
def
can_update_password
(
self
):
return
self
.
is_local
@property
def
otp_secret_key
(
self
):
...
...
apps/users/templates/users/user_detail.html
View file @
d0af8eba
...
...
@@ -177,6 +177,7 @@
</span>
</td>
</tr>
{% if user_object.can_update_password %}
<tr>
<td>
{% trans 'Send reset password mail' %}:
</td>
<td>
...
...
@@ -185,6 +186,7 @@
</span>
</td>
</tr>
{% endif %}
<tr>
<td>
{% trans 'Send reset ssh key mail' %}:
</td>
<td>
...
...
apps/users/templates/users/user_profile.html
View file @
d0af8eba
...
...
@@ -148,14 +148,6 @@
<div
class=
"panel-body"
>
<table
class=
"table"
>
<tbody>
<tr
class=
"no-borders-tr"
>
<td>
{% trans 'Update password' %}:
</td>
<td>
<span
class=
"pull-right"
>
<a
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
href=
"{% url 'users:user-password-update' %}"
>
{% trans 'Update' %}
</a>
</span>
</td>
</tr>
<tr
class=
"no-borders-tr"
>
<td>
{% trans 'Set MFA' %}:
</td>
<td>
...
...
@@ -177,6 +169,16 @@
</span>
</td>
</tr>
{% if request.user.can_update_password %}
<tr
class=
"no-borders"
>
<td>
{% trans 'Update password' %}:
</td>
<td>
<span
class=
"pull-right"
>
<a
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
href=
"{% url 'users:user-password-update' %}"
>
{% trans 'Update' %}
</a>
</span>
</td>
</tr>
{% endif %}
{% if request.user.otp_enabled and request.user.otp_secret_key %}
<tr>
<td>
{% trans 'Update MFA' %}:
</td>
...
...
apps/users/templates/users/user_update.html
View file @
d0af8eba
...
...
@@ -3,6 +3,7 @@
{% load bootstrap3 %}
{% block user_template_title %}{% trans "Update user" %}{% endblock %}
{% block password %}
{% if object.can_update_password %}
{% bootstrap_field form.password layout="horizontal" %}
{# 密码popover #}
<div
id=
"container"
>
...
...
@@ -14,13 +15,24 @@
<div
class=
"popover-content"
></div>
</div>
</div>
{% else %}
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
{% trans 'Password' %}
</label>
<div
class=
"col-sm-8 controls"
style=
"margin-top: 8px;"
id=
"password_help_text"
>
{% trans 'User auth from {}, go there change password' %}
</div>
</div>
{% endif %}
{% bootstrap_field form.public_key layout="horizontal" %}
{% endblock %}
{% block custom_foot_js %}
{{ block.super }}
<script>
$
(
document
).
ready
(
function
(){
function
passwordCheck
()
{
if
(
$
(
'#id_password'
).
length
!=
1
)
{
return
}
var
el
=
$
(
'#id_password_rules'
),
idPassword
=
$
(
'#id_password'
),
idPopover
=
$
(
'#popover777'
),
...
...
@@ -39,11 +51,11 @@
"veryStrong"
:
"{% trans 'Very strong' %}"
};
jQuery
.
each
(
password_check_rules
,
function
(
idx
,
rules
)
{
if
(
rules
.
key
===
'id_security_password_min_length'
){
minLength
=
rules
.
value
}
});
$
.
each
(
password_check_rules
,
function
(
idx
,
rules
)
{
if
(
rules
.
key
===
'id_security_password_min_length'
){
minLength
=
rules
.
value
}
});
// 初始化popover
initPopover
(
container
,
progress
,
idPassword
,
el
,
password_check_rules
,
i18n_fallback
);
...
...
@@ -61,6 +73,13 @@
var
password
=
idPassword
.
val
();
checkPasswordRules
(
password
,
minLength
);
});
}
$
(
document
).
ready
(
function
(){
passwordCheck
();
var
origin_text
=
$
(
"#password_help_text"
).
text
();
var
new_text
=
origin_text
.
replace
(
'{}'
,
"{{ object.source_display }}"
);
$
(
"#password_help_text"
).
html
(
new_text
);
})
</script>
...
...
apps/users/views/login.py
View file @
d0af8eba
...
...
@@ -239,7 +239,7 @@ class UserForgotPasswordView(TemplateView):
if
not
user
:
error
=
_
(
'Email address invalid, please input again'
)
return
self
.
get
(
request
,
errors
=
error
)
elif
not
user
.
is_local
:
elif
not
user
.
can_update_password
()
:
error
=
_
(
'User auth from {}, go there change password'
.
format
(
user
.
source
))
return
self
.
get
(
request
,
errors
=
error
)
else
:
...
...
@@ -298,6 +298,9 @@ class UserResetPasswordView(TemplateView):
return
self
.
get
(
request
,
errors
=
_
(
'Password not same'
))
user
=
User
.
validate_reset_token
(
token
)
if
not
user
.
can_update_password
():
error
=
_
(
'User auth from {}, go there change password'
.
format
(
user
.
source
))
return
self
.
get
(
request
,
errors
=
error
)
if
not
user
:
return
self
.
get
(
request
,
errors
=
_
(
'Token invalid or expired'
))
...
...
apps/users/views/user.py
View file @
d0af8eba
...
...
@@ -414,6 +414,12 @@ class UserPasswordUpdateView(LoginRequiredMixin, UpdateView):
return
super
()
.
get_success_url
()
def
form_valid
(
self
,
form
):
if
not
self
.
request
.
user
.
can_update_password
():
error
=
_
(
"User auth from {}, go there change password"
)
.
format
(
self
.
request
.
source_display
)
form
.
add_error
(
"password"
,
error
)
return
self
.
form_invalid
(
form
)
password
=
form
.
cleaned_data
.
get
(
'new_password'
)
is_ok
=
check_password_rules
(
password
)
if
not
is_ok
:
...
...
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