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
5b52b907
Commit
5b52b907
authored
Apr 20, 2018
by
BaiJiangjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 创建用户,更新用户,添加MFA设置选项
parent
8447c6f4
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
40 deletions
+45
-40
django.mo
apps/i18n/zh/LC_MESSAGES/django.mo
+0
-0
django.po
apps/i18n/zh/LC_MESSAGES/django.po
+30
-31
forms.py
apps/users/forms.py
+7
-2
user.py
apps/users/models/user.py
+1
-1
_user.html
apps/users/templates/users/_user.html
+4
-1
user_create.html
apps/users/templates/users/user_create.html
+3
-4
user_update.html
apps/users/templates/users/user_update.html
+0
-1
No files found.
apps/i18n/zh/LC_MESSAGES/django.mo
View file @
5b52b907
No preview for this file type
apps/i18n/zh/LC_MESSAGES/django.po
View file @
5b52b907
...
...
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Jumpserver 0.3.3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-20 1
1:17
+0800\n"
"POT-Creation-Date: 2018-04-20 1
6:08
+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: Jumpserver team<ibuler@qq.com>\n"
...
...
@@ -172,7 +172,7 @@ msgstr "密码或密钥密码"
#: users/forms.py:15 users/forms.py:24 users/forms.py:36
#: users/templates/users/login.html:59
#: users/templates/users/reset_password.html:52
#: users/templates/users/user_create.html:1
1
#: users/templates/users/user_create.html:1
0
#: users/templates/users/user_password_authentication.html:14
#: users/templates/users/user_password_update.html:40
#: users/templates/users/user_profile_update.html:40
...
...
@@ -430,7 +430,7 @@ msgstr "默认资产组"
#: terminal/templates/terminal/command_list.html:32
#: terminal/templates/terminal/command_list.html:72
#: terminal/templates/terminal/session_list.html:33
#: terminal/templates/terminal/session_list.html:71 users/forms.py:23
1
#: terminal/templates/terminal/session_list.html:71 users/forms.py:23
7
#: users/models/user.py:30 users/models/user.py:287
#: users/templates/users/user_group_detail.html:78
#: users/templates/users/user_group_list.html:13 users/views/user.py:339
...
...
@@ -605,8 +605,7 @@ msgstr "基本"
#: assets/templates/assets/asset_update.html:30
#: assets/templates/assets/gateway_create_update.html:45
#: assets/templates/assets/system_user_update.html:7
#: users/templates/users/user_create.html:9
#: users/templates/users/user_update.html:6
#: users/templates/users/_user.html:21
msgid "Auth"
msgstr "认证"
...
...
@@ -637,7 +636,7 @@ msgstr "其它"
#: common/templates/common/terminal_setting.html:101
#: perms/templates/perms/asset_permission_create_update.html:69
#: terminal/templates/terminal/terminal_update.html:47
#: users/templates/users/_user.html:4
3
#: users/templates/users/_user.html:4
6
#: users/templates/users/user_bulk_update.html:23
#: users/templates/users/user_password_update.html:58
#: users/templates/users/user_profile.html:181
...
...
@@ -663,7 +662,7 @@ msgstr "重置"
#: perms/templates/perms/asset_permission_create_update.html:70
#: terminal/templates/terminal/session_list.html:120
#: terminal/templates/terminal/terminal_update.html:48
#: users/templates/users/_user.html:4
4
#: users/templates/users/_user.html:4
7
#: users/templates/users/first_login.html:62
#: users/templates/users/forgot_password.html:44
#: users/templates/users/user_bulk_update.html:24
...
...
@@ -1705,8 +1704,8 @@ msgstr "任务列表"
msgid "Task run history"
msgstr "执行历史"
#: perms/forms.py:18 users/forms.py:1
88 users/forms.py:193 users/forms.py:205
#: users/forms.py:2
35
#: perms/forms.py:18 users/forms.py:1
94 users/forms.py:199 users/forms.py:211
#: users/forms.py:2
41
msgid "Select users"
msgstr "选择用户"
...
...
@@ -1854,8 +1853,8 @@ msgstr "商业支持"
msgid "Docs"
msgstr "文档"
#: templates/_header_bar.html:37 templates/_nav_user.html:9 users/forms.py:1
05
#: users/templates/users/_user.html:3
6
#: templates/_header_bar.html:37 templates/_nav_user.html:9 users/forms.py:1
11
#: users/templates/users/_user.html:3
9
#: users/templates/users/user_password_update.html:37
#: users/templates/users/user_profile.html:17
#: users/templates/users/user_profile_update.html:37
...
...
@@ -2230,10 +2229,10 @@ msgid "Invalid token or cache refreshed."
msgstr ""
#: users/forms.py:30
msgid "MFA
_
code"
msgstr ""
msgid "MFA
code"
msgstr "
MFA 验证码
"
#: users/forms.py:
39
users/models/user.py:43
#: users/forms.py:
40
users/models/user.py:43
#: users/templates/users/_select_user_modal.html:15
#: users/templates/users/user_detail.html:87
#: users/templates/users/user_list.html:25
...
...
@@ -2241,55 +2240,55 @@ msgstr ""
msgid "Role"
msgstr "角色"
#: users/forms.py:4
1 users/forms.py:151
#: users/forms.py:4
2 users/forms.py:157
msgid "ssh public key"
msgstr "ssh公钥"
#: users/forms.py:4
2 users/forms.py:152
#: users/forms.py:4
3 users/forms.py:158
msgid "ssh-rsa AAAA..."
msgstr ""
#: users/forms.py:4
3
#: users/forms.py:4
4
msgid "Paste user id_rsa.pub here."
msgstr "复制用户公钥到这里"
#: users/forms.py:6
1
users/templates/users/user_detail.html:196
#: users/forms.py:6
2
users/templates/users/user_detail.html:196
msgid "Join user groups"
msgstr "添加到用户组"
#: users/forms.py:7
1 users/forms.py:166
#: users/forms.py:7
3 users/forms.py:172
msgid "Public key should not be the same as your old one."
msgstr "不能和原来的密钥相同"
#: users/forms.py:7
5 users/forms.py:170
users/serializers.py:45
#: users/forms.py:7
7 users/forms.py:176
users/serializers.py:45
msgid "Not a valid ssh public key"
msgstr "ssh密钥不合法"
#: users/forms.py:11
1
#: users/forms.py:11
7
msgid "Old password"
msgstr "原来密码"
#: users/forms.py:1
16
#: users/forms.py:1
22
msgid "New password"
msgstr "新密码"
#: users/forms.py:12
1
#: users/forms.py:12
7
msgid "Confirm password"
msgstr "确认密码"
#: users/forms.py:13
1
#: users/forms.py:13
7
msgid "Old password error"
msgstr "原来密码错误"
#: users/forms.py:1
39
#: users/forms.py:1
45
msgid "Password does not match"
msgstr "密码不一致"
#: users/forms.py:15
3
#: users/forms.py:15
9
msgid "Paste your id_rsa.pub here."
msgstr "复制你的公钥到这里"
#: users/forms.py:18
1
users/models/user.py:51
#: users/forms.py:18
7
users/models/user.py:51
#: users/templates/users/user_password_update.html:43
#: users/templates/users/user_profile.html:68
#: users/templates/users/user_profile_update.html:43
...
...
@@ -2358,8 +2357,8 @@ msgid "Wechat"
msgstr "微信"
#: users/models/user.py:47
msgid "
Enable OTP
"
msgstr "
二次验证
"
msgid "
MFA
"
msgstr "
MFA
"
#: users/models/user.py:298
msgid "Administrator is the super user of system"
...
...
@@ -2378,7 +2377,7 @@ msgstr "资产数量"
msgid "Account"
msgstr "账户"
#: users/templates/users/_user.html:2
3
#: users/templates/users/_user.html:2
6
msgid "Security and Role"
msgstr "角色安全"
...
...
@@ -2492,7 +2491,7 @@ msgstr "设置"
msgid "Create user"
msgstr "创建用户"
#: users/templates/users/user_create.html:1
3
#: users/templates/users/user_create.html:1
2
msgid "Reset link will be generated and sent to the user. "
msgstr "生成重置密码连接,通过邮件发送给用户"
...
...
apps/users/forms.py
View file @
5b52b907
...
...
@@ -27,7 +27,7 @@ class UserCheckPasswordForm(forms.Form):
class
UserCheckOtpCodeForm
(
forms
.
Form
):
otp_code
=
forms
.
CharField
(
label
=
_
(
'MFA
_
code'
),
max_length
=
6
)
otp_code
=
forms
.
CharField
(
label
=
_
(
'MFA
code'
),
max_length
=
6
)
class
UserCreateUpdateForm
(
forms
.
ModelForm
):
...
...
@@ -47,7 +47,7 @@ class UserCreateUpdateForm(forms.ModelForm):
model
=
User
fields
=
[
'username'
,
'name'
,
'email'
,
'groups'
,
'wechat'
,
'phone'
,
'role'
,
'date_expired'
,
'comment'
,
'phone'
,
'role'
,
'date_expired'
,
'comment'
,
'otp_level'
]
help_texts
=
{
'username'
:
'* required'
,
...
...
@@ -61,6 +61,7 @@ class UserCreateUpdateForm(forms.ModelForm):
'data-placeholder'
:
_
(
'Join user groups'
)
}
),
'otp_level'
:
forms
.
RadioSelect
()
}
def
clean_public_key
(
self
):
...
...
@@ -77,11 +78,15 @@ class UserCreateUpdateForm(forms.ModelForm):
def
save
(
self
,
commit
=
True
):
password
=
self
.
cleaned_data
.
get
(
'password'
)
otp_level
=
self
.
cleaned_data
.
get
(
'otp_level'
)
public_key
=
self
.
cleaned_data
.
get
(
'public_key'
)
user
=
super
()
.
save
(
commit
=
commit
)
if
password
:
user
.
set_password
(
password
)
user
.
save
()
if
otp_level
:
user
.
otp_level
=
otp_level
user
.
save
()
if
public_key
:
user
.
public_key
=
public_key
user
.
save
()
...
...
apps/users/models/user.py
View file @
5b52b907
...
...
@@ -44,7 +44,7 @@ class User(AbstractUser):
avatar
=
models
.
ImageField
(
upload_to
=
"avatar"
,
null
=
True
,
verbose_name
=
_
(
'Avatar'
))
wechat
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
verbose_name
=
_
(
'Wechat'
))
phone
=
models
.
CharField
(
max_length
=
20
,
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
'Phone'
))
otp_level
=
models
.
SmallIntegerField
(
default
=
0
,
choices
=
OTP_LEVEL_CHOICES
,
verbose_name
=
_
(
'
Enable OTP
'
))
otp_level
=
models
.
SmallIntegerField
(
default
=
0
,
choices
=
OTP_LEVEL_CHOICES
,
verbose_name
=
_
(
'
MFA
'
))
_otp_secret_key
=
models
.
CharField
(
max_length
=
128
,
blank
=
True
,
null
=
True
)
# Todo: Auto generate key, let user download
_private_key
=
models
.
CharField
(
max_length
=
5000
,
blank
=
True
,
verbose_name
=
_
(
'Private key'
))
...
...
apps/users/templates/users/_user.html
View file @
5b52b907
...
...
@@ -17,7 +17,10 @@
{% bootstrap_field form.groups layout="horizontal" %}
<div
class=
"hr-line-dashed"
></div>
{% block password %} {% endblock %}
<h3>
{% trans 'Auth' %}
</h3>
{% block password %}{% endblock %}
{% bootstrap_field form.otp_level layout="horizontal" %}
<div
class=
"hr-line-dashed"
></div>
<h3>
{% trans 'Security and Role' %}
</h3>
...
...
apps/users/templates/users/user_create.html
View file @
5b52b907
...
...
@@ -6,11 +6,11 @@
{# {% bootstrap_field form.username layout="horizontal" %}#}
{#{% endblock %}#}
{% block password %}
<h3>
{% trans 'Auth' %}
</h3>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
{% trans 'Password' %}
</label>
<div
class=
"col-sm-8 controls"
>
<div
class=
"col-sm-8 controls"
style=
"margin-top: 8px;"
>
{% trans 'Reset link will be generated and sent to the user. ' %}
</div>
</div>
{% endblock %}
\ No newline at end of file
{% endblock %}
apps/users/templates/users/user_update.html
View file @
5b52b907
...
...
@@ -3,7 +3,6 @@
{% load bootstrap3 %}
{% block user_template_title %}{% trans "Update user" %}{% endblock %}
{% block password %}
<h3>
{% trans 'Auth' %}
</h3>
{% bootstrap_field form.password layout="horizontal" %}
{% bootstrap_field form.public_key layout="horizontal" %}
{% endblock %}
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