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
c9d192ee
Commit
c9d192ee
authored
Aug 02, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'github/org' into org
parents
9c4ebf9c
485a178c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
75 additions
and
7 deletions
+75
-7
django.mo
apps/i18n/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/i18n/zh/LC_MESSAGES/django.po
+0
-0
jumpserver.js
apps/static/js/jumpserver.js
+9
-1
forms.py
apps/users/forms.py
+24
-0
reset_password.html
apps/users/templates/users/reset_password.html
+10
-2
user_password_update.html
apps/users/templates/users/user_password_update.html
+10
-2
user_update.html
apps/users/templates/users/user_update.html
+10
-2
user.py
apps/users/views/user.py
+12
-0
No files found.
apps/i18n/zh/LC_MESSAGES/django.mo
View file @
c9d192ee
No preview for this file type
apps/i18n/zh/LC_MESSAGES/django.po
View file @
c9d192ee
This diff is collapsed.
Click to expand it.
apps/static/js/jumpserver.js
View file @
c9d192ee
...
...
@@ -685,7 +685,7 @@ function popoverPasswordRules(password_check_rules, $el) {
}
// 初始化弹窗popover
function
initPopover
(
$container
,
$progress
,
$idPassword
,
$el
,
password_check_rules
){
function
initPopover
(
$container
,
$progress
,
$idPassword
,
$el
,
password_check_rules
,
i18n_fallback
){
options
=
{};
// User Interface
options
.
ui
=
{
...
...
@@ -697,6 +697,14 @@ function initPopover($container, $progress, $idPassword, $el, password_check_rul
showProgressbar
:
true
,
showVerdictsInsideProgressBar
:
true
};
options
.
i18n
=
{
fallback
:
i18n_fallback
,
t
:
function
(
key
)
{
var
result
=
''
;
result
=
options
.
i18n
.
fallback
[
key
];
return
result
===
key
?
''
:
result
;
}
};
$idPassword
.
pwstrength
(
options
);
popoverPasswordRules
(
password_check_rules
,
$el
);
}
apps/users/forms.py
View file @
c9d192ee
...
...
@@ -78,6 +78,30 @@ class UserCreateUpdateForm(OrgModelForm):
)
}
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
request
=
kwargs
.
pop
(
"request"
,
None
)
super
(
UserCreateUpdateForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
roles
=
[]
# Super admin user
if
self
.
request
.
user
.
is_superuser
:
roles
.
append
((
User
.
ROLE_ADMIN
,
dict
(
User
.
ROLE_CHOICES
)
.
get
(
User
.
ROLE_ADMIN
)))
roles
.
append
((
User
.
ROLE_USER
,
dict
(
User
.
ROLE_CHOICES
)
.
get
(
User
.
ROLE_USER
)))
# Org admin user
else
:
user
=
kwargs
.
get
(
'instance'
)
# Update
if
user
:
role
=
kwargs
.
get
(
'instance'
)
.
role
roles
.
append
((
role
,
dict
(
User
.
ROLE_CHOICES
)
.
get
(
role
)))
# Create
else
:
roles
.
append
((
User
.
ROLE_USER
,
dict
(
User
.
ROLE_CHOICES
)
.
get
(
User
.
ROLE_USER
)))
field
=
self
.
fields
[
'role'
]
field
.
choices
=
set
(
roles
)
def
clean_public_key
(
self
):
public_key
=
self
.
cleaned_data
[
'public_key'
]
if
not
public_key
:
...
...
apps/users/templates/users/reset_password.html
View file @
c9d192ee
...
...
@@ -100,10 +100,18 @@
progress
=
$
(
'#id_progress'
),
password_check_rules
=
{{
password_check_rules
|
safe
}},
minLength
=
{{
min_length
}},
top
=
146
,
left
=
170
;
top
=
146
,
left
=
170
,
i18n_fallback
=
{
"veryWeak"
:
"{% trans 'Very weak' %}"
,
"weak"
:
"{% trans 'Weak' %}"
,
"normal"
:
"{% trans 'Normal' %}"
,
"medium"
:
"{% trans 'Medium' %}"
,
"strong"
:
"{% trans 'Strong' %}"
,
"veryStrong"
:
"{% trans 'Very strong' %}"
};
// 初始化popover
initPopover
(
container
,
progress
,
idPassword
,
el
,
password_check_rules
);
initPopover
(
container
,
progress
,
idPassword
,
el
,
password_check_rules
,
i18n_fallback
);
// 监听事件
idPassword
.
on
(
'focus'
,
function
()
{
...
...
apps/users/templates/users/user_password_update.html
View file @
c9d192ee
...
...
@@ -93,10 +93,18 @@
password_check_rules
=
{{
password_check_rules
|
safe
}},
minLength
=
{{
min_length
}},
top
=
idPassword
.
offset
().
top
-
$
(
'.navbar'
).
outerHeight
(
true
)
-
$
(
'.page-heading'
).
outerHeight
(
true
)
-
10
+
34
,
left
=
377
;
left
=
377
,
i18n_fallback
=
{
"veryWeak"
:
"{% trans 'Very weak' %}"
,
"weak"
:
"{% trans 'Weak' %}"
,
"normal"
:
"{% trans 'Normal' %}"
,
"medium"
:
"{% trans 'Medium' %}"
,
"strong"
:
"{% trans 'Strong' %}"
,
"veryStrong"
:
"{% trans 'Very strong' %}"
};
// 初始化popover
initPopover
(
container
,
progress
,
idPassword
,
el
,
password_check_rules
);
initPopover
(
container
,
progress
,
idPassword
,
el
,
password_check_rules
,
i18n_fallback
);
// 监听事件
idPassword
.
on
(
'focus'
,
function
()
{
...
...
apps/users/templates/users/user_update.html
View file @
c9d192ee
...
...
@@ -29,10 +29,18 @@
password_check_rules
=
{{
password_check_rules
|
safe
}},
minLength
=
{{
min_length
}},
top
=
idPassword
.
offset
().
top
-
$
(
'.navbar'
).
outerHeight
(
true
)
-
$
(
'.page-heading'
).
outerHeight
(
true
)
-
10
+
34
,
left
=
377
;
left
=
377
,
i18n_fallback
=
{
"veryWeak"
:
"{% trans 'Very weak' %}"
,
"weak"
:
"{% trans 'Weak' %}"
,
"normal"
:
"{% trans 'Normal' %}"
,
"medium"
:
"{% trans 'Medium' %}"
,
"strong"
:
"{% trans 'Strong' %}"
,
"veryStrong"
:
"{% trans 'Very strong' %}"
};
// 初始化popover
initPopover
(
container
,
progress
,
idPassword
,
el
,
password_check_rules
);
initPopover
(
container
,
progress
,
idPassword
,
el
,
password_check_rules
,
i18n_fallback
);
// 监听事件
idPassword
.
on
(
'focus'
,
function
()
{
...
...
apps/users/views/user.py
View file @
c9d192ee
...
...
@@ -90,6 +90,12 @@ class UserCreateView(AdminUserRequiredMixin, SuccessMessageMixin, CreateView):
post_user_create
.
send
(
self
.
__class__
,
user
=
user
)
return
super
()
.
form_valid
(
form
)
def
get_form_kwargs
(
self
):
kwargs
=
super
(
UserCreateView
,
self
)
.
get_form_kwargs
()
data
=
{
'request'
:
self
.
request
}
kwargs
.
update
(
data
)
return
kwargs
class
UserUpdateView
(
AdminUserRequiredMixin
,
SuccessMessageMixin
,
UpdateView
):
model
=
User
...
...
@@ -123,6 +129,12 @@ class UserUpdateView(AdminUserRequiredMixin, SuccessMessageMixin, UpdateView):
return
self
.
form_invalid
(
form
)
return
super
()
.
form_valid
(
form
)
def
get_form_kwargs
(
self
):
kwargs
=
super
(
UserUpdateView
,
self
)
.
get_form_kwargs
()
data
=
{
'request'
:
self
.
request
}
kwargs
.
update
(
data
)
return
kwargs
class
UserBulkUpdateView
(
AdminUserRequiredMixin
,
TemplateView
):
model
=
User
...
...
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