Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gjl2004yn
jumpserver
提交
f2746844
J
jumpserver
项目概览
gjl2004yn
/
jumpserver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jumpserver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f2746844
编写于
9月 04, 2016
作者:
baltery
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add translation for support i18n
上级
ba3f46fb
变更
24
显示空白变更内容
内联
并排
Showing
24 changed file
with
682 addition
and
264 deletion
+682
-264
apps/common/templates/common/flash_message_standalone.html
apps/common/templates/common/flash_message_standalone.html
+1
-1
apps/jumpserver/settings.py
apps/jumpserver/settings.py
+4
-2
apps/locale/zh_CN/LC_MESSAGES/django.mo
apps/locale/zh_CN/LC_MESSAGES/django.mo
+0
-0
apps/locale/zh_CN/LC_MESSAGES/django.po
apps/locale/zh_CN/LC_MESSAGES/django.po
+504
-0
apps/templates/_header_bar.html
apps/templates/_header_bar.html
+5
-4
apps/templates/_nav.html
apps/templates/_nav.html
+21
-20
apps/templates/_pagination.html
apps/templates/_pagination.html
+4
-4
apps/templates/_user_profile.html
apps/templates/_user_profile.html
+4
-4
apps/templates/base.html
apps/templates/base.html
+1
-1
apps/users/forms.py
apps/users/forms.py
+5
-4
apps/users/models.py
apps/users/models.py
+23
-21
apps/users/templates/users/_user.html
apps/users/templates/users/_user.html
+8
-7
apps/users/templates/users/forget_password.html
apps/users/templates/users/forget_password.html
+4
-3
apps/users/templates/users/login.html
apps/users/templates/users/login.html
+6
-11
apps/users/templates/users/reset_password.html
apps/users/templates/users/reset_password.html
+5
-7
apps/users/templates/users/user_add.html
apps/users/templates/users/user_add.html
+4
-3
apps/users/templates/users/user_delete_confirm.html
apps/users/templates/users/user_delete_confirm.html
+2
-1
apps/users/templates/users/user_detail.html
apps/users/templates/users/user_detail.html
+24
-24
apps/users/templates/users/user_edit.html
apps/users/templates/users/user_edit.html
+4
-3
apps/users/templates/users/user_list.bak.html
apps/users/templates/users/user_list.bak.html
+0
-92
apps/users/templates/users/user_list.html
apps/users/templates/users/user_list.html
+15
-15
apps/users/utils.py
apps/users/utils.py
+20
-19
apps/users/views.py
apps/users/views.py
+17
-18
config-example.py
config-example.py
+1
-0
未找到文件。
apps/common/templates/common/flash_message_standalone.html
浏览文件 @
f2746844
...
...
@@ -71,7 +71,7 @@
}
}
{
%
if
auto_redirect
%
}
window
.
onload
=
redirect_page
window
.
onload
=
redirect_page
;
{
%
endif
%
}
</script>
</html>
apps/jumpserver/settings.py
浏览文件 @
f2746844
...
...
@@ -215,7 +215,7 @@ LOGGING = {
# Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/
LANGUAGE_CODE
=
'en
-us
'
LANGUAGE_CODE
=
'en
_US
'
TIME_ZONE
=
'Asia/Shanghai'
...
...
@@ -225,6 +225,9 @@ USE_L10N = True
USE_TZ
=
True
# I18N translation
LOCALE_PATHS
=
[
os
.
path
.
join
(
BASE_DIR
,
'locale'
),]
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/
...
...
@@ -246,7 +249,6 @@ BOOTSTRAP_COLUMN_COUNT = 11
# Init data or generate fake data source for development
FIXTURE_DIRS
=
[
os
.
path
.
join
(
BASE_DIR
,
'fixtures'
),
]
# Email config
EMAIL_HOST
=
CONFIG
.
EMAIL_HOST
EMAIL_PORT
=
CONFIG
.
EMAIL_PORT
...
...
apps/locale/zh_CN/LC_MESSAGES/django.mo
0 → 100644
浏览文件 @
f2746844
文件已添加
apps/locale/zh_CN/LC_MESSAGES/django.po
0 → 100644
浏览文件 @
f2746844
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-04 00:49+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: templates/_header_bar.html:8 users/templates/users/user_detail.html:29
msgid "Search"
msgstr "搜索"
#: templates/_header_bar.html:14
msgid "Welcome use Jumpserver system"
msgstr "欢迎使用Jumpserver开源跳板机系统"
#: templates/_header_bar.html:18
msgid "Help"
msgstr "帮助"
#: templates/_header_bar.html:35 templates/_nav.html:4
msgid "Home"
msgstr "仪表盘"
#: templates/_nav.html:9 users/views.py:100 users/views.py:113
#: users/views.py:155 users/views.py:173 users/views.py:197 users/views.py:210
msgid "Users"
msgstr "用户管理"
#: templates/_nav.html:12 users/models.py:103
#, fuzzy
#| msgid "Users"
msgid "User"
msgstr "用户管理"
#: templates/_nav.html:13 users/models.py:109
#: users/templates/users/user_detail.html:181
#: users/templates/users/user_list.html:15
msgid "Usergroup"
msgstr "用户组"
#: templates/_nav.html:18
msgid "Assets"
msgstr "资产管理"
#: templates/_nav.html:21
msgid "Asset"
msgstr "资产管理"
#: templates/_nav.html:22
msgid "Assetgroup"
msgstr "用户组"
#: templates/_nav.html:23
msgid "IDC"
msgstr "机房"
#: templates/_nav.html:24
msgid "Opsuser"
msgstr "管理用户"
#: templates/_nav.html:25
msgid "Sysuser"
msgstr "系统用户"
#: templates/_nav.html:26
msgid "Label"
msgstr "标签"
#: templates/_nav.html:30
msgid "Perms"
msgstr "权限"
#: templates/_nav.html:33
msgid "Perm"
msgstr "权限"
#: templates/_nav.html:36
msgid "Create perm"
msgstr "创建权限"
#: templates/_nav.html:42
msgid "Audit"
msgstr "审计"
#: templates/_nav.html:47
msgid "File"
msgstr "文件"
#: templates/_nav.html:50
msgid "File upload"
msgstr "文件上传"
#: templates/_nav.html:51
msgid "File download"
msgstr "文件下载"
#: templates/_nav.html:56
msgid "Settings"
msgstr "设置"
#: templates/_nav.html:61
msgid "Visit us"
msgstr "访问官网"
#: templates/_user_profile.html:19 users/templates/users/_user.html:62
msgid "Profile"
msgstr "个人信息"
#: templates/_user_profile.html:21
msgid "Logout"
msgstr "注销登录"
#: templates/captcha/image.html:3
msgid "Play CAPTCHA as audio file"
msgstr ""
#: users/forms.py:12 users/models.py:106 users/templates/users/login.html:57
#: users/templates/users/user_detail.html:73
#: users/templates/users/user_edit.html:5
#: users/templates/users/user_list.html:13
msgid "Username"
msgstr "用户名"
#: users/forms.py:13 users/templates/users/login.html:60
#: users/templates/users/reset_password.html:52
#: users/templates/users/user_add.html:8
#: users/templates/users/user_add.html:10
#: users/templates/users/user_edit.html:12
#: users/templates/users/user_edit.html:14
msgid "Password"
msgstr "密码"
#: users/forms.py:31 users/forms.py:50
#, fuzzy
msgid "Join usergroups"
msgstr "添加到用户组"
#: users/models.py:60 users/models.py:107
#: users/templates/users/user_detail.html:69
#: users/templates/users/user_list.html:12
msgid "Name"
msgstr "名称"
#: users/models.py:61 users/models.py:118
#: users/templates/users/user_detail.html:113
msgid "Comment"
msgstr "备注"
#: users/models.py:102 users/models.py:225
msgid "Administrator"
msgstr "管理员"
#: users/models.py:108 users/templates/users/user_detail.html:77
msgid "Email"
msgstr "邮件"
#: users/models.py:110 users/templates/users/user_detail.html:93
#: users/templates/users/user_list.html:14
msgid "Role"
msgstr "角色"
#: users/models.py:111
msgid "Avatar"
msgstr "头像"
#: users/models.py:112 users/templates/users/user_detail.html:88
msgid "Wechat"
msgstr "微信"
#: users/models.py:113 users/templates/users/user_detail.html:82
msgid "Phone"
msgstr "手机"
#: users/models.py:114 users/templates/users/_user.html:56
msgid "Enable OTP"
msgstr "二次验证"
#: users/models.py:116
msgid "ssh private key"
msgstr "ssh密钥"
#: users/models.py:117
msgid "ssh public key"
msgstr "ssh公钥"
#: users/models.py:121 users/templates/users/user_detail.html:97
msgid "Date expired"
msgstr "失效日期"
#: users/models.py:228
msgid "Administrator is the super user of system"
msgstr "Administrator是初始的超级管理员"
#: users/models.py:229
msgid "System"
msgstr "系统"
#: users/templates/users/_user.html:17 users/templates/users/user_list.html:5
#: users/views.py:113
msgid "Create user"
msgstr "创建用户"
#: users/templates/users/_user.html:33
msgid "Account"
msgstr "账户"
#: users/templates/users/_user.html:43
msgid "Security and Role"
msgstr "角色安全"
#: users/templates/users/_user.html:69
#: users/templates/users/user_detail.html:162
#: users/templates/users/user_detail.html:170
msgid "Reset"
msgstr "重置"
#: users/templates/users/_user.html:70
#: users/templates/users/forget_password.html:44
#: users/templates/users/user_list.html:63
msgid "Commit"
msgstr "提交"
#: users/templates/users/forget_password.html:26
msgid "Forget password"
msgstr "忘记密码"
#: users/templates/users/forget_password.html:33
msgid "Input your email, that will send a mail to your"
msgstr "输入您的邮箱, 将会发一封重置短信邮件到您的邮箱中"
#: users/templates/users/login.html:45 users/templates/users/login.html:65
msgid "Login"
msgstr "登录"
#: users/templates/users/login.html:50
msgid "Captcha invalid"
msgstr "验证码错误"
#: users/templates/users/reset_password.html:45
#: users/templates/users/user_detail.html:159 users/utils.py:98
msgid "Reset password"
msgstr "重置密码"
#: users/templates/users/reset_password.html:55
msgid "Password again"
msgstr "再次输入密码"
#: users/templates/users/reset_password.html:57
msgid "Setting"
msgstr "设置"
#: users/templates/users/user_add.html:12
msgid "Reset link will be generated and sent to the user. "
msgstr "生成重置密码连接,通过邮件发送给用户"
#: users/templates/users/user_delete_confirm.html:6
msgid "Confirm delete"
msgstr "确认删除"
#: users/templates/users/user_detail.html:18 users/views.py:173
msgid "User detail"
msgstr "用户详情"
#: users/templates/users/user_detail.html:20
msgid "User assets"
msgstr "用户资产"
#: users/templates/users/user_detail.html:21
msgid "User log"
msgstr "登录日志"
#: users/templates/users/user_detail.html:101
msgid "Created by"
msgstr "创建者"
#: users/templates/users/user_detail.html:105
msgid "Date joined"
msgstr "加入日期"
#: users/templates/users/user_detail.html:109
msgid "Last login"
msgstr "最后登录"
#: users/templates/users/user_detail.html:124
msgid "Quick modify"
msgstr "快速修改"
#: users/templates/users/user_detail.html:167
msgid "Reset ssh key"
msgstr "重置密钥"
#: users/templates/users/user_detail.html:189
msgid "Select usergroups"
msgstr "选择用户组"
#: users/templates/users/user_detail.html:198
msgid "Add"
msgstr "添加"
#: users/templates/users/user_list.html:16
msgid "Asset num"
msgstr "资产数量"
#: users/templates/users/user_list.html:17
msgid "Active"
msgstr "有效"
#: users/templates/users/user_list.html:44
msgid "Edit"
msgstr "编辑"
#: users/templates/users/user_list.html:45
msgid "Delete"
msgstr "删除"
#: users/templates/users/user_list.html:55
msgid "Delete selected"
msgstr "批量删除"
#: users/templates/users/user_list.html:56
msgid "Update selected"
msgstr "批量更新"
#: users/templates/users/user_list.html:57
msgid "Deactive selected"
msgstr "禁用所选"
#: users/templates/users/user_list.html:58
msgid "Export selected"
msgstr "批量导出"
#: users/utils.py:47
msgid "Begin to generate ssh private key ..."
msgstr "开始生成ssh密钥"
#: users/utils.py:59
msgid "Finish to generate ssh private key ..."
msgstr "生成ssh密钥成功"
#: users/utils.py:63
msgid "These is error when generate ssh key."
msgstr "创建密钥失败"
#: users/utils.py:67
msgid "Create account successfully"
msgstr "创建账户成功"
#: users/utils.py:69
#, python-format
msgid ""
"\n"
" Hello %(name)s:\n"
" </br>\n"
" Your account has been created successfully\n"
" </br>\n"
" <a href=\"%(rest_password_url)s?token=%(rest_password_token)s\">click "
"here to set your password</a>\n"
" </br>\n"
" This link is valid for 1 hour. After it expires, <a href=\"%"
"(forget_password_url)s?email=%(email)s\">request new one</a>\n"
"\n"
" </br>\n"
" ---\n"
"\n"
" </br>\n"
" <a href=\"%(login_url)s\">Login direct</a>\n"
"\n"
" </br>\n"
" "
msgstr ""
"\n"
" 你好 %(name)s:\n"
" </br>\n"
" 恭喜您,您的账号已经创建成功 </br>\n"
" <a href=\"%(rest_password_url)s?token=%(rest_password_token)s\">请点击这"
"里设置密码</a> </br>\n"
" 这个链接有效期1小时, 超过时间您可以 <a href=\"%(forget_password_url)s?"
"email=%(email)s\">重新申请</a>\n"
"\n"
" </br>\n"
" ---\n"
"\n"
" </br>\n"
" <a href=\"%(login_url)s\">Login direct</a>\n"
"\n"
" </br>\n"
" "
#: users/utils.py:100
#, python-format
msgid ""
"\n"
" Hello %(name)s:\n"
" </br>\n"
" Please click the link below to reset your password, if not your request, "
"concern your account security\n"
" </br>\n"
" <a href=\"%(rest_password_url)s?token=%(rest_password_token)s\">Click "
"here reset password</a>\n"
" </br>\n"
" This link is valid for 1 hour. After it expires, <a href=\"%"
"(forget_password_url)s?email=%(email)s\">request new one<</a>\n"
"\n"
" </br>\n"
" ---\n"
"\n"
" </br>\n"
" <a href=\"%(login_url)s\">Login direct</a>\n"
"\n"
" </br>\n"
" "
msgstr ""
"\n"
" 您好 %(name)s:\n"
" </br>\n"
" 请点击下面链接重置密码, 如果不是您申请的,请关注账号安全\n"
" </br>\n"
" <a href=\"%(rest_password_url)s?token=%(rest_password_token)s\">请点击这"
"里设置密码 /a>\n"
" </br>\n"
" 这个链接有效期1小时, 超过时间您可以<a href=\"%(forget_password_url)s?"
"email=%(email)s\">重新申请</a>\n"
"\n"
" </br>\n"
" ---\n"
"\n"
" </br>\n"
" <a href=\"%(login_url)s\">直接登录</a>\n"
"\n"
" </br>\n"
" "
#: users/views.py:53
msgid "Username or password invalid"
msgstr "用户名或密码错误"
#: users/views.py:70
msgid "Logout success"
msgstr "退出登录成功"
#: users/views.py:71
msgid "Logout success, return login page"
msgstr "退出登录成功,返回到登录页面"
#: users/views.py:100
msgid "User list"
msgstr "用户列表"
#: users/views.py:109
#, python-format
msgid "Create user<a href=\"%s\">%s</a> success."
msgstr "创建用户<a href=\"%s\">%s</a> 成功"
#: users/views.py:155
msgid "Edit user"
msgstr "编辑用户"
#: users/views.py:197
msgid "Usergroup list"
msgstr "用户组列表"
#: users/views.py:210
msgid "Create usergroup"
msgstr "创建用户组"
#: users/views.py:242
msgid "Email address invalid, input again"
msgstr "邮箱地址错误,重新输入"
#: users/views.py:253
msgid "Send reset password message"
msgstr "发送重置密码邮件"
#: users/views.py:254
msgid "Send reset password mail success, login your mail box and follow it "
msgstr ""
"发送重置邮件成功, 请登录邮箱查看, 按照提示操作 (如果没收到,请等待3-5分钟)"
#: users/views.py:266
msgid "Reset password success"
msgstr "重置密码成功"
#: users/views.py:267
msgid "Reset password success, return to login page"
msgstr "重置密码成功,返回到登录页面"
#: users/views.py:283 users/views.py:296
msgid "Token invalid or expired"
msgstr "Token错误或失效"
#: users/views.py:292
msgid "Password not same"
msgstr "密码不一致"
apps/templates/_header_bar.html
浏览文件 @
f2746844
{% load i18n %}
<div
class=
"row border-bottom"
>
<nav
class=
"navbar navbar-static-top white-bg"
role=
"navigation"
style=
"margin-bottom: 0"
>
<div
class=
"navbar-header"
>
<a
class=
"navbar-minimalize minimalize-styl-2 btn btn-primary "
href=
"#"
><i
class=
"fa fa-bars"
></i>
</a>
<form
role=
"search"
class=
"navbar-form-custom"
method=
"get"
action=
""
>
<div
class=
"form-group"
>
<input
type=
"text"
placeholder=
"
输入搜索
..."
class=
"form-control"
name=
"search"
id=
"top-search"
>
<input
type=
"text"
placeholder=
"
{% trans 'Search' %}
..."
class=
"form-control"
name=
"search"
id=
"top-search"
>
</div>
</form>
</div>
<ul
class=
"nav navbar-top-links navbar-right"
>
<li>
<span
class=
"m-r-sm text-muted welcome-message"
>
欢迎使用Jumpserver开源跳板机系统
</span>
<span
class=
"m-r-sm text-muted welcome-message"
>
{% trans 'Welcome use Jumpserver system' %}
</span>
</li>
<li
class=
"dropdown"
>
<a
class=
"dropdown-toggle count-info"
data-toggle=
"dropdown"
href=
"#"
>
<span
class=
"m-r-sm text-muted welcome-message"
>
帮助
</span>
<span
class=
"m-r-sm text-muted welcome-message"
>
{% trans 'Help' %}
</span>
</a>
</li>
<li>
...
...
@@ -31,7 +32,7 @@
<h2></h2>
<ol
class=
"breadcrumb"
>
<li>
<a
href=
""
>
仪表盘
</a>
<a
href=
""
>
{% trans 'Home' %}
</a>
</li>
<li>
{% if app %}
...
...
apps/templates/_nav.html
浏览文件 @
f2746844
{% load i18n %}
<li
id=
"index"
>
<a
href=
""
>
<i
class=
"fa fa-dashboard"
></i>
<span
class=
"nav-label"
>
仪表盘
</span><span
class=
"label label-info pull-right"
></span>
<i
class=
"fa fa-dashboard"
></i>
<span
class=
"nav-label"
>
{% trans 'Home' %}
</span><span
class=
"label label-info pull-right"
></span>
</a>
</li>
<li
id=
"users"
>
<a
href=
"#"
>
<i
class=
"fa fa-group"
></i>
<span
class=
"nav-label"
>
用户管理
</span><span
class=
"fa arrow"
></span>
<i
class=
"fa fa-group"
></i>
<span
class=
"nav-label"
>
{% trans 'Users' %}
</span><span
class=
"fa arrow"
></span>
</a>
<ul
class=
"nav nav-second-level active"
>
<li
class=
"users"
><a
href=
"{% url 'users:user-list' %}"
>
用户列表
</a></li>
<li
class=
"usergroups"
><a
href=
"{% url 'users:usergroup-list' %}"
>
用户组列表
</a></li>
<li
class=
"users"
><a
href=
"{% url 'users:user-list' %}"
>
{% trans 'User' %}
</a></li>
<li
class=
"usergroups"
><a
href=
"{% url 'users:usergroup-list' %}"
>
{% trans 'Usergroup' %}
</a></li>
</ul>
</li>
<li
id=
""
>
<a>
<i
class=
"fa fa-inbox"
></i>
<span
class=
"nav-label"
>
资产管理
</span><span
class=
"fa arrow"
></span>
<i
class=
"fa fa-inbox"
></i>
<span
class=
"nav-label"
>
{% trans 'Assets' %}
</span><span
class=
"fa arrow"
></span>
</a>
<ul
class=
"nav nav-second-level"
>
<li
class=
""
><a
href=
""
>
资产列表
</a></li>
<li
class=
""
><a
href=
""
>
资产组列表
</a></li>
<li
class=
""
><a
href=
""
>
机房列表
</a></li>
<li
class=
""
><a
href=
""
>
管理用户
</a></li>
<li
class=
""
><a
href=
""
>
系统用户
</a></li>
<li
class=
""
><a
href=
""
>
标签列表
</a></li>
<li
class=
""
><a
href=
""
>
{% trans 'Asset' %}
</a></li>
<li
class=
""
><a
href=
""
>
{% trans 'Assetgroup' %}
</a></li>
<li
class=
""
><a
href=
""
>
{% trans 'IDC' %}
</a></li>
<li
class=
""
><a
href=
""
>
{% trans 'Opsuser' %}
</a></li>
<li
class=
""
><a
href=
""
>
{% trans 'Sysuser' %}
</a></li>
<li
class=
""
><a
href=
""
>
{% trans 'Label' %}
</a></li>
</ul>
</li>
<li
id=
""
>
<a
href=
"#"
><i
class=
"fa fa-edit"
></i>
<span
class=
"nav-label"
>
授权管理
</span><span
class=
"fa arrow"
></span></a>
<a
href=
"#"
><i
class=
"fa fa-edit"
></i>
<span
class=
"nav-label"
>
{% trans 'Perms' %}
</span><span
class=
"fa arrow"
></span></a>
<ul
class=
"nav nav-second-level"
>
<li
class=
"sudo"
>
<a
class=
"sudo"
href=
""
>
授权列表
</a>
<a
class=
"sudo"
href=
""
>
{% trans 'Perm' %}
</a>
</li>
<li
class=
"role"
>
<a
href=
""
>
添加授权
</a>
<a
href=
""
>
{% trans 'Create perm' %}
</a>
</li>
</ul>
</li>
<li
id=
""
>
<a
href=
""
>
<i
class=
"fa fa-files-o"
></i><span
class=
"nav-label"
>
审计管理
</span><span
class=
"label label-info pull-right"
></span>
<i
class=
"fa fa-files-o"
></i><span
class=
"nav-label"
>
{% trans 'Audit' %}
</span><span
class=
"label label-info pull-right"
></span>
</a>
</li>
<li
id=
""
>
<a
href=
"#"
>
<i
class=
"fa fa-download"
></i>
<span
class=
"nav-label"
>
上传下载
</span><span
class=
"fa arrow"
></span>
<i
class=
"fa fa-download"
></i>
<span
class=
"nav-label"
>
{% trans 'File' %}
</span><span
class=
"fa arrow"
></span>
</a>
<ul
class=
"nav nav-second-level"
>
<li
class=
"upload"
><a
href=
""
>
文件上传
</a></li>
<li
class=
"download"
><a
href=
""
>
文件下载
</a></li>
<li
class=
"upload"
><a
href=
""
>
{% trans 'File upload' %}
</a></li>
<li
class=
"download"
><a
href=
""
>
{% trans 'File download' %}
</a></li>
</ul>
</li>
<li
id=
""
>
<a
href=
""
>
<i
class=
"fa fa-gears"
></i>
<span
class=
"nav-label"
>
设置
</span><span
class=
"label label-info pull-right"
></span>
<i
class=
"fa fa-gears"
></i>
<span
class=
"nav-label"
>
{% trans 'Settings' %}
</span><span
class=
"label label-info pull-right"
></span>
</a>
</li>
<li
class=
"special_link"
>
<a
href=
"http://www.jumpserver.org"
target=
"_blank"
><i
class=
"fa fa-database"
></i>
<span
class=
"nav-label"
>
访问官网
</span>
<span
class=
"nav-label"
>
{% trans 'Visit us' %}
</span>
</a>
</li>
\ No newline at end of file
apps/templates/_pagination.html
浏览文件 @
f2746844
...
...
@@ -34,10 +34,10 @@
</div>
{% endif %}
<script>
function
sleep
(
n
)
{
//n表示的毫秒数
var
start
=
new
Date
().
getTime
();
while
(
true
)
if
(
new
Date
().
getTime
()
-
start
>
n
)
break
;
}
{
#
function
sleep
(
n
)
{
//n表示的毫秒数#}
{
#
var
start
=
new
Date
().
getTime
();
#
}
{
#
while
(
true
)
if
(
new
Date
().
getTime
()
-
start
>
n
)
break
;
#
}
{
#
}
#
}
$
(
document
).
ready
(
function
()
{
$
(
'
.page
'
).
click
(
function
()
{
...
...
apps/templates/_user_profile.html
浏览文件 @
f2746844
{% load static %}
{% load i18n %}
<li
class=
"nav-header"
>
<div
class=
"dropdown profile-element"
>
<span>
...
...
@@ -10,15 +11,14 @@
<strong
class=
"font-bold"
>
{{ request.user.name }}
<span
style=
"color: #8095a8"
></span></strong>
</span>
<span
class=
"text-muted text-xs block"
>
{{ request.user.get_role_display | default:
'普通用户'
}}
<b
class=
"caret"
></b>
{{ request.user.get_role_display | default:
"{% trans 'User' %}"
}}
<b
class=
"caret"
></b>
</span>
</span>
</a>
<ul
class=
"dropdown-menu animated fadeInRight m-t-xs"
>
<li><a
value=
""
>
个人信息
</a></li>
<li><a
href=
""
>
修改信息
</a></li>
<li><a
value=
""
>
{% trans 'Profile' %}
</a></li>
<li
class=
"divider"
></li>
<li><a
href=
""
>
注销
</a></li>
<li><a
href=
""
>
{% trans 'Logout' %}
</a></li>
</ul>
</div>
<div
class=
"logo-element"
>
...
...
apps/templates/base.html
浏览文件 @
f2746844
...
...
@@ -6,7 +6,7 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"renderer"
content=
"webkit"
>
<title>
Jumpserver
| 开源跳板机系统
</title>
<title>
Jumpserver
</title>
<link
rel=
"shortcut icon"
href=
{%
static
"
img
/
facio.ico
"
%}
type=
"image/x-icon"
>
{% include '_head_css_js.html' %}
...
...
apps/users/forms.py
浏览文件 @
f2746844
...
...
@@ -3,13 +3,14 @@
from
django.forms
import
ModelForm
from
django
import
forms
from
captcha.fields
import
CaptchaField
from
django.utils.translation
import
gettext_lazy
as
_
from
.models
import
User
,
UserGroup
class
UserLoginForm
(
forms
.
Form
):
username
=
forms
.
CharField
(
label
=
'用户名'
,
max_length
=
100
)
password
=
forms
.
CharField
(
label
=
'密码'
,
widget
=
forms
.
PasswordInput
,
max_length
=
100
)
username
=
forms
.
CharField
(
label
=
_
(
'Username'
)
,
max_length
=
100
)
password
=
forms
.
CharField
(
label
=
_
(
'Password'
)
,
widget
=
forms
.
PasswordInput
,
max_length
=
100
)
captcha
=
CaptchaField
()
...
...
@@ -27,7 +28,7 @@ class UserAddForm(ModelForm):
}
widgets
=
{
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
'请选择用户组'
}),
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Join usergroups'
)
}),
}
...
...
@@ -46,7 +47,7 @@ class UserUpdateForm(ModelForm):
}
widgets
=
{
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
'请选择用户组'
}),
'groups'
:
forms
.
SelectMultiple
(
attrs
=
{
'class'
:
'select2'
,
'data-placeholder'
:
_
(
'Join usergroups'
)
}),
}
...
...
apps/users/models.py
浏览文件 @
f2746844
...
...
@@ -12,6 +12,7 @@ from django.contrib.auth.models import AbstractUser, Permission
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
from
django.db
import
IntegrityError
from
django.utils.translation
import
ugettext_lazy
as
_
from
rest_framework.authtoken.models
import
Token
from
django.core
import
signing
...
...
@@ -56,8 +57,8 @@ from django.core import signing
class
UserGroup
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
,
unique
=
True
,
verbose_name
=
'组名称'
)
comment
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
'描述'
)
name
=
models
.
CharField
(
max_length
=
100
,
unique
=
True
,
verbose_name
=
_
(
'Name'
)
)
comment
=
models
.
TextField
(
blank
=
True
,
verbose_name
=
_
(
'Comment'
)
)
date_added
=
models
.
DateTimeField
(
auto_now_add
=
True
)
created_by
=
models
.
CharField
(
max_length
=
100
)
...
...
@@ -98,25 +99,26 @@ def date_expired_default():
class
User
(
AbstractUser
):
ROLE_CHOICES
=
(
(
'Admin'
,
'管理员'
),
(
'User'
,
'用户'
),
(
'Admin'
,
_
(
'Administrator'
)
),
(
'User'
,
_
(
'User'
)
),
)
username
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
,
verbose_name
=
'用户名'
)
name
=
models
.
CharField
(
max_length
=
20
,
blank
=
True
,
verbose_name
=
'姓名'
)
email
=
models
.
EmailField
(
max_length
=
30
,
unique
=
True
,
verbose_name
=
'邮件'
)
groups
=
models
.
ManyToManyField
(
UserGroup
,
related_name
=
'users'
,
blank
=
True
,
verbose_name
=
'用户组'
)
role
=
models
.
CharField
(
choices
=
ROLE_CHOICES
,
default
=
'User'
,
max_length
=
10
,
blank
=
True
,
verbose_name
=
'角色'
)
avatar
=
models
.
ImageField
(
upload_to
=
"avatar"
,
verbose_name
=
'头像'
)
wechat
=
models
.
CharField
(
max_length
=
30
,
blank
=
True
,
verbose_name
=
'微信'
)
phone
=
models
.
CharField
(
max_length
=
20
,
blank
=
True
,
verbose_name
=
'手机号'
)
enable_otp
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
'启用二次验证'
)
username
=
models
.
CharField
(
max_length
=
20
,
unique
=
True
,
verbose_name
=
_
(
'Username'
)
)
name
=
models
.
CharField
(
max_length
=
20
,
blank
=
True
,
verbose_name
=
_
(
'Name'
)
)
email
=
models
.
EmailField
(
max_length
=
30
,
unique
=
True
,
verbose_name
=
_
(
'Email'
)
)
groups
=
models
.
ManyToManyField
(
UserGroup
,
related_name
=
'users'
,
blank
=
True
,
verbose_name
=
_
(
'Usergroup'
)
)
role
=
models
.
CharField
(
choices
=
ROLE_CHOICES
,
default
=
'User'
,
max_length
=
10
,
blank
=
True
,
verbose_name
=
_
(
'Role'
)
)
avatar
=
models
.
ImageField
(
upload_to
=
"avatar"
,
verbose_name
=
_
(
'Avatar'
)
)
wechat
=
models
.
CharField
(
max_length
=
30
,
blank
=
True
,
verbose_name
=
_
(
'Wechat'
)
)
phone
=
models
.
CharField
(
max_length
=
20
,
blank
=
True
,
verbose_name
=
_
(
'Phone'
)
)
enable_otp
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
_
(
'Enable OTP'
)
)
secret_key_otp
=
models
.
CharField
(
max_length
=
16
,
blank
=
True
)
private_key
=
models
.
CharField
(
max_length
=
5000
,
blank
=
True
,
verbose_name
=
'ssh私钥'
)
# ssh key max length 4096 bit
public_key
=
models
.
CharField
(
max_length
=
1000
,
blank
=
True
,
verbose_name
=
'公钥'
)
comment
=
models
.
TextField
(
max_length
=
200
,
blank
=
True
,
verbose_name
=
'描述'
)
private_key
=
models
.
CharField
(
max_length
=
5000
,
blank
=
True
,
verbose_name
=
_
(
'ssh private key'
))
public_key
=
models
.
CharField
(
max_length
=
1000
,
blank
=
True
,
verbose_name
=
_
(
'ssh public key'
)
)
comment
=
models
.
TextField
(
max_length
=
200
,
blank
=
True
,
verbose_name
=
_
(
'Comment'
)
)
is_first_login
=
models
.
BooleanField
(
default
=
False
)
date_expired
=
models
.
DateTimeField
(
default
=
date_expired_default
,
blank
=
True
,
null
=
True
,
verbose_name
=
'有效期'
)
date_expired
=
models
.
DateTimeField
(
default
=
date_expired_default
,
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
'Date expired'
))
created_by
=
models
.
CharField
(
max_length
=
30
,
default
=
''
)
@
property
...
...
@@ -204,7 +206,7 @@ class User(AbstractUser):
user_email
=
data
.
get
(
'email'
,
''
)
user
=
cls
.
objects
.
get
(
id
=
user_id
,
email
=
user_email
)
except
signing
.
BadSignature
,
cls
.
DoesNotExist
:
except
(
signing
.
BadSignature
,
cls
.
DoesNotExist
)
:
user
=
None
return
user
...
...
@@ -220,11 +222,11 @@ class User(AbstractUser):
def
initial
(
cls
):
user
=
cls
(
username
=
'admin'
,
email
=
'admin@jumpserver.org'
,
name
=
'Administrator'
,
name
=
_
(
'Administrator'
)
,
password_raw
=
'admin'
,
role
=
'Admin'
,
comment
=
'Administrator is the super user of system'
,
created_by
=
'System'
)
comment
=
_
(
'Administrator is the super user of system'
)
,
created_by
=
_
(
'System'
)
)
user
.
save
()
user
.
groups
.
add
(
UserGroup
.
initial
())
...
...
apps/users/templates/users/_user.html
浏览文件 @
f2746844
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load bootstrap %}
{% block custom_head_css_js %}
...
...
@@ -13,7 +14,7 @@
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
填写用户信息
</h5>
<h5>
{% trans 'Create user' %}
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapse-link"
>
<i
class=
"fa fa-chevron-up"
></i>
...
...
@@ -29,7 +30,7 @@
<div
class=
"ibox-content"
>
<form
method=
"post"
id=
"userForm"
class=
"form-horizontal"
action=
""
enctype=
"multipart/form-data"
>
{% csrf_token %}
<h3>
账户
</h3>
<h3>
{% trans 'Account' %}
</h3>
{% block username %} {% endblock %}
{{ form.email|bootstrap_horizontal }}
{{ form.name|bootstrap_horizontal }}
...
...
@@ -39,7 +40,7 @@
{% block password %} {% endblock %}
<div
class=
"hr-line-dashed"
></div>
<h3>
角色安全
</h3>
<h3>
{% trans 'Security and Role' %}
</h3>
{{ form.role|bootstrap_horizontal }}
<div
class=
"form-group {% if form.date_expired.errors %} has-error {% endif %}"
id=
"date_5"
>
<label
for=
"{{ form.date_expired.id_for_label }}"
class=
"col-sm-2 control-label"
>
{{ form.date_expired.label }}
</label>
...
...
@@ -52,21 +53,21 @@
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"{{ form.enable_otp.id_for_label }}"
class=
"col-sm-2 control-label"
>
二次验证
</label>
<label
for=
"{{ form.enable_otp.id_for_label }}"
class=
"col-sm-2 control-label"
>
{% trans 'Enable OTP' %}
</label>
<div
class=
"col-sm-8"
>
{{ form.enable_otp }}
</div>
</div>
<div
class=
"hr-line-dashed"
></div>
<h3>
信息
</h3>
<h3>
{% trans 'Profile' %}
</h3>
{{ form.phone|bootstrap_horizontal }}
{{ form.wechat|bootstrap_horizontal }}
{{ form.comment|bootstrap_horizontal }}
<div
class=
"hr-line-dashed"
></div>
<div
class=
"form-group"
>
<div
class=
"col-sm-4 col-sm-offset-2"
>
<button
class=
"btn btn-white"
type=
"reset"
>
取消
</button>
<button
id=
"submit_button"
class=
"btn btn-primary"
type=
"submit"
>
确认保存
</button>
<button
class=
"btn btn-white"
type=
"reset"
>
{% trans 'Reset' %}
</button>
<button
id=
"submit_button"
class=
"btn btn-primary"
type=
"submit"
>
{% trans 'Commit' %}
</button>
</div>
</div>
</form>
...
...
apps/users/templates/users/forget_password.html
浏览文件 @
f2746844
{% load static %}
{% load i18n %}
<!DOCTYPE html>
<html>
...
...
@@ -22,14 +23,14 @@
<div
class=
"ibox-content"
>
<img
src=
"{% static 'img/logo.png' %}"
style=
"margin: auto"
width=
"82"
height=
"82"
>
<h2
class=
"font-bold"
style=
"display: inline"
>
忘记密码
?
</h2>
<h2
class=
"font-bold"
style=
"display: inline"
>
{% trans 'Forget password' %}
?
</h2>
<h1></h1>
{% if errors %}
<p
class=
"red-fonts"
>
{{ errors }}
</p>
{% endif %}
<p>
输入您的邮箱, 将会发一封重置短信邮件到您的邮箱中
{% trans 'Input your email, that will send a mail to your' %}
</p>
<div
class=
"row"
>
...
...
@@ -40,7 +41,7 @@
<input
type=
"email"
name=
"email"
class=
"form-control"
placeholder=
"Email address"
required=
""
>
</div>
<button
type=
"submit"
class=
"btn btn-primary block full-width m-b"
>
重置密码
</button>
<button
type=
"submit"
class=
"btn btn-primary block full-width m-b"
>
{% trans 'Commit' %}
</button>
</form>
</div>
...
...
apps/users/templates/users/login.html
浏览文件 @
f2746844
{% load static %}
{% load i18n %}
<!DOCTYPE html>
<html>
...
...
@@ -23,23 +24,17 @@
<body
class=
"gray-bg"
>
<div
class=
"loginColumns animated fadeInDown"
>
<div
class=
"row"
>
<div
class=
"col-md-6"
>
<h2
class=
"font-bold"
>
欢迎使用Jumpserver开源跳板机
</h2>
<p>
Jumpserver是一款使用Python, Django开发的开源跳板机系统, 助力互联网企业高效 用户、资产、权限、审计 管理
</p>
<p>
我们自五湖四海,我们对开源精神无比敬仰和崇拜,我们对完美、整洁、优雅 无止境的追求
</p>
<p>
专注自动化运维,努力打造 易用、稳定、安全、自动化 的跳板机, 这是我们的不懈的追求和动力
</p>
<p>
<small>
永远年轻,永远热泪盈眶 stay foolish stay hungry
</small>
</p>
...
...
@@ -47,27 +42,27 @@
</div>
<div
class=
"col-md-6"
>
<div
class=
"ibox-content"
>
<div><img
src=
"{% static 'img/logo.png' %}"
width=
"82"
height=
"82"
>
<span
class=
"font-bold text-center"
style=
"font-size: 32px; font-family: inherit"
>
登录
</span></div>
<div><img
src=
"{% static 'img/logo.png' %}"
width=
"82"
height=
"82"
>
<span
class=
"font-bold text-center"
style=
"font-size: 32px; font-family: inherit"
>
{% trans 'Login' %}
</span></div>
<form
class=
"m-t"
role=
"form"
method=
"post"
action=
"{% url 'users:login' %}"
>
{% csrf_token %}
{% if form.errors %}
{% if 'captcha' in form.errors %}
<p
class=
"red-fonts"
>
验证码错误
</p>
<p
class=
"red-fonts"
>
{% trans 'Captcha invalid' %}
</p>
{% endif %}
{% endif %}
{% if errors %}
<p
class=
"red-fonts"
>
{{ errors }}
</p>
{% endif %}
<div
class=
"form-group"
>
<input
type=
"text"
class=
"form-control"
name=
"{{ form.username.html_name }}"
placeholder=
"
Username
"
required=
""
>
<input
type=
"text"
class=
"form-control"
name=
"{{ form.username.html_name }}"
placeholder=
"
{% trans 'Username' %}
"
required=
""
>
</div>
<div
class=
"form-group"
>
<input
type=
"password"
class=
"form-control"
name=
"{{ form.password.html_name }}"
placeholder=
"
Password
"
required=
""
>
<input
type=
"password"
class=
"form-control"
name=
"{{ form.password.html_name }}"
placeholder=
"
{% trans 'Password' %}
"
required=
""
>
</div>
<div>
{{ form.captcha }}
</div>
<button
type=
"submit"
class=
"btn btn-primary block full-width m-b"
>
Login
</button>
<button
type=
"submit"
class=
"btn btn-primary block full-width m-b"
>
{% trans 'Login' %}
</button>
<a
href=
"{% url 'users:forget-password' %}"
>
<small>
Forgot password?
</small>
...
...
apps/users/templates/users/reset_password.html
浏览文件 @
f2746844
{% load static %}
{% load i18n %}
<!DOCTYPE html>
<html>
...
...
@@ -41,31 +42,28 @@
</div>
<div
class=
"col-md-6"
>
<div
class=
"ibox-content"
>
<div><img
src=
"{% static 'img/logo.png' %}"
width=
"82"
height=
"82"
>
<span
class=
"font-bold text-center"
style=
"font-size: 32px; font-family: inherit"
>
重设密码
</span></div>
<div><img
src=
"{% static 'img/logo.png' %}"
width=
"82"
height=
"82"
>
<span
class=
"font-bold text-center"
style=
"font-size: 32px; font-family: inherit"
>
{% trans 'Reset password' %}
</span></div>
<form
class=
"m-t"
role=
"form"
method=
"post"
action=
""
>
{% csrf_token %}
{% if errors %}
<p
class=
"red-fonts"
>
{{ errors }}
</p>
{% endif %}
<div
class=
"form-group"
>
<input
type=
"password"
class=
"form-control"
name=
"password"
placeholder=
"
Password
"
required=
""
>
<input
type=
"password"
class=
"form-control"
name=
"password"
placeholder=
"
{% trans 'Password' %}
"
required=
""
>
</div>
<div
class=
"form-group"
>
<input
type=
"password"
class=
"form-control"
name=
"password-confirm"
placeholder=
"
Password again
"
required=
""
>
<input
type=
"password"
class=
"form-control"
name=
"password-confirm"
placeholder=
"
{% trans 'Password again' %}
"
required=
""
>
</div>
<button
type=
"submit"
class=
"btn btn-primary block full-width m-b"
>
Setting
</button>
<button
type=
"submit"
class=
"btn btn-primary block full-width m-b"
>
{% trans "Setting" %}
</button>
<a
href=
"#"
>
<small>
Forgot password?
</small>
</a>
<p
class=
"text-muted text-center"
>
{#
<small>
Do not have an account?
</small>
#}
</p>
{#
<a
class=
"btn btn-sm btn-white btn-block"
href=
"register.html"
>
Create an account
</a>
#}
</form>
<p
class=
"m-t"
>
{#
<small>
Inspinia we app framework base on Bootstrap 3
©
2014
</small>
#}
</p>
</div>
</div>
...
...
apps/users/templates/users/user_add.html
浏览文件 @
f2746844
{% extends 'users/_user.html' %}
{% load i18n %}
{% load bootstrap %}
{% block username %}
{{ form.username|bootstrap_horizontal }}
{% endblock %}
{% block password %}
<h3>
密码
</h3>
<h3>
{% trans 'Password' %}
</h3>
<div
class=
"form-group"
>
<label
class=
"col-sm-2 control-label"
>
密码
</label>
<label
class=
"col-sm-2 control-label"
>
{% trans 'Password' %}
</label>
<div
class=
"col-sm-8 controls"
>
生成重置密码连接,通过邮件发送给用户
{% trans 'Reset link will be generated and sent to the user. ' %}
</div>
</div>
{% endblock %}
\ No newline at end of file
apps/users/templates/users/user_delete_confirm.html
浏览文件 @
f2746844
{% load i18n %}
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<title>
确认删除
</title>
<title>
{% trans 'Confirm delete' %}
</title>
</head>
<body>
<form
action=
""
method=
"post"
>
...
...
apps/users/templates/users/user_detail.html
浏览文件 @
f2746844
...
...
@@ -2,6 +2,7 @@
{% load common_tags %}
{% load users_tags %}
{% load static %}
{% load i18n %}
{% block custom_head_css_js %}
<link
href=
"{% static "
css
/
plugins
/
select2
/
select2.min.css
"
%}"
rel=
"stylesheet"
>
...
...
@@ -12,13 +13,12 @@
<div
class=
"row"
>
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
{#
<div
class=
"ibox-content"
>
#}
<div
class=
"panel-options"
>
<ul
class=
"nav nav-tabs"
>
<li
class=
"active"
><a
href=
""
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
用户信息
</a>
<li
class=
"active"
><a
href=
""
class=
"text-center"
><i
class=
"fa fa-laptop"
></i>
{% trans 'User detail' %}
</a>
</li>
<li><a
href=
""
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
用户资产
</a></li>
<li><a
href=
""
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
登录记录
</a></li>
<li><a
href=
""
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
{% trans 'User assets' %}
</a></li>
<li><a
href=
""
class=
"text-center"
><i
class=
"fa fa-bar-chart-o"
></i>
{% trans 'User log' %}
</a></li>
<div
class=
""
style=
"float: right"
>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
...
...
@@ -26,7 +26,7 @@
value=
"{{ keyword }}"
placeholder=
"Search"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
搜索
{% trans 'Search' %}
</button>
</div>
</div>
...
...
@@ -66,51 +66,51 @@
</td>
</tr>
<tr>
<td
width=
"20%"
>
姓名
:
</td>
<td
width=
"20%"
>
{% trans 'Name' %}
:
</td>
<td><b>
{{ user.name }}
</b></td>
</tr>
<tr>
<td>
用户名
:
</td>
<td>
{% trans 'Username' %}
:
</td>
<td><b>
{{ user.username }}
</b></td>
</tr>
<tr>
<td>
邮件
:
</td>
<td>
{% trans 'Email' %}
:
</td>
<td><b>
{{ user.email }}
</b></td>
</tr>
{% if user.phone %}
<tr>
<td>
手机
:
</td>
<td>
{% trans 'Phone' %}
:
</td>
<td><b>
{{ user.phone }}
</b></td>
</tr>
{% endif %}
{% if user.wechat %}
<tr>
<td>
微信
:
</td>
<td>
{% trans 'Wechat' %}
:
</td>
<td><b>
{{ user.wechat }}
</b></td>
</tr>
{% endif %}
<tr>
<td>
角色
:
</td>
<td>
{% trans 'Role' %}
:
</td>
<td><b>
{{ user.get_role_display }}
</b></td>
</tr>
<tr>
<td>
有效期
:
</td>
<td>
{% trans 'Date expired' %}
:
</td>
<td><b>
{{ user.date_expired|date:"Y-m-j H:i:s" }}
</b></td>
</tr>
<tr>
<td>
创建者
:
</td>
<td>
{% trans 'Created by' %}
:
</td>
<td><b>
{{ user.created_by }}
</b></td>
</tr>
<tr>
<td>
创建日期
:
</td>
<td>
{% trans 'Date joined' %}
:
</td>
<td><b>
{{ user.date_joined|date:"Y-m-j H:i:s" }}
</b></td>
</tr>
<tr>
<td>
最后登录
:
</td>
<td>
{% trans 'Last login' %}
:
</td>
<td><b>
{{ user.last_login|date:"Y-m-j H:i:s" }}
</b></td>
</tr>
<tr>
<td>
描述
:
</td>
<td>
{% trans 'Comment' %}
:
</td>
<td><b>
{{ user.comment }}
</b></td>
</tr>
</tbody>
...
...
@@ -121,7 +121,7 @@
<div
class=
"col-sm-5"
style=
"padding-left: 0px;"
>
<div
class=
"panel panel-primary"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
快速修改
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Quick modify' %}
</div>
<div
class=
"panel-body"
>
<table
class=
"table"
>
...
...
@@ -156,18 +156,18 @@
</span></td>
</tr>
<tr>
<td>
重置密码
:
</td>
<td>
{% trans 'Reset password' %}
:
</td>
<td>
<span
style=
"float: right"
>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
>
重置
</button>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px"
>
{% trans 'Reset' %}
</button>
</span>
</td>
</tr>
<tr>
<td>
重置密钥
:
</td>
<td>
{% trans 'Reset ssh key' %}
:
</td>
<td>
<span
style=
"float: right"
>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px;"
>
重置
</button>
<button
type=
"button"
class=
"btn btn-primary btn-xs"
style=
"width: 54px;"
>
{% trans 'Reset' %}
</button>
</span>
</td>
</tr>
...
...
@@ -178,7 +178,7 @@
<div
class=
"panel panel-info"
>
<div
class=
"panel-heading"
>
<i
class=
"fa fa-info-circle"
></i>
用户组
<i
class=
"fa fa-info-circle"
></i>
{% trans 'Usergroup' %}
</div>
<div
class=
"panel-body"
>
<table
class=
"table"
>
...
...
@@ -186,7 +186,7 @@
<form>
<tr>
<td
colspan=
"2"
class=
"no-borders"
>
<select
data-placeholder=
"
选择用户组
"
class=
"select2"
style=
"width: 100%"
multiple=
""
tabindex=
"4"
>
<select
data-placeholder=
"
{% trans 'Select usergroups' %}
"
class=
"select2"
style=
"width: 100%"
multiple=
""
tabindex=
"4"
>
{% for group in groups %}
<option
value=
"{{ group.id }}"
>
{{ group.name }}
</option>
{% endfor %}
...
...
@@ -195,7 +195,7 @@
</tr>
<tr>
<td
colspan=
"2"
class=
"no-borders"
>
<button
type=
"button"
class=
"btn btn-info btn-small"
>
添加到用户组
</button>
<button
type=
"button"
class=
"btn btn-info btn-small"
>
{% trans 'Add' %}
</button>
</td>
</tr>
</form>
...
...
apps/users/templates/users/user_edit.html
浏览文件 @
f2746844
{% extends 'users/_user.html' %}
{% load i18n %}
{% block username %}
<div
class=
"form-group"
>
<label
for=
"{{ form.username.id_for_label }}"
class=
"col-sm-2 control-label"
>
用户名
</label>
<label
for=
"{{ form.username.id_for_label }}"
class=
"col-sm-2 control-label"
>
{% trans 'Username' %}
</label>
<div
class=
"col-sm-9 controls"
>
<input
id=
"{{ form.username.id_for_label }}"
name=
"{{ form.username.html_name }}"
type=
"text"
value=
"{{ user.username }}"
readonly
class=
"form-control"
>
</div>
</div>
{% endblock %}
{% block password %}
<h3>
密码
</h3>
<h3>
{% trans 'Password' %}
</h3>
<div
class=
"form-group"
>
<label
for=
"password"
class=
"col-sm-2 control-label"
>
密码
</label>
<label
for=
"password"
class=
"col-sm-2 control-label"
>
{% trans 'Password' %}
</label>
<div
class=
"col-sm-9 controls"
>
<input
id=
"password"
name=
"password"
type=
"password"
class=
"form-control"
>
</div>
...
...
apps/users/templates/users/user_list.bak.html
已删除
100644 → 0
浏览文件 @
ba3f46fb
{% extends '_list_base.html' %}
{% load common_tags %}
<div
class=
"col-sm-12"
>
<div
class=
"ibox float-e-margins"
>
<div
class=
"ibox-title"
>
<h5>
查看用户
</h5>
<div
class=
"ibox-tools"
>
<a
class=
"collapise-link"
>
<i
class=
"fa fa-chevron-up"
></i>
</a>
<a
class=
"dropdown-toggle"
data-toggle=
"dropdown"
href=
"#"
>
<i
class=
"fa fa-wrench"
></i>
</a>
<a
class=
"close-link"
>
<i
class=
"fa fa-times"
></i>
</a>
</div>
</div>
<div
class=
"ibox-content"
>
<div
class=
""
>
<a
href=
"{% url 'users:user-add' %}"
class=
"btn btn-sm btn-primary "
>
添加用户
</a>
<a
id=
"del_btn"
class=
"btn btn-sm btn-danger "
>
删除所选
</a>
<form
id=
"search_form"
method=
"get"
action=
""
class=
"pull-right mail-search"
>
<div
class=
"input-group"
>
<input
type=
"text"
class=
"form-control input-sm"
name=
"keyword"
placeholder=
"用户名或姓名"
value=
"{{ keyword }}"
>
<div
class=
"input-group-btn"
>
<button
id=
'search_btn'
type=
"submit"
class=
"btn btn-sm btn-primary"
>
搜索
</button>
</div>
</div>
</form>
</div>
<table
class=
"table table-striped table-bordered table-hover "
id=
"editable"
>
<thead>
<tr>
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=name"
>
姓名
</a></th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=username"
>
用户名
</a></th>
<th
class=
"text-center"
>
角色
</th>
<th
class=
"text-center"
>
用户组
</th>
<th
class=
"text-center"
>
资产数量
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=date_expired"
>
有效
</a></th>
<th
class=
"text-center"
></th>
</tr>
</thead>
<tbody>
{% for user in user_list %}
<tr
class=
"gradeX"
>
<td
class=
"text-center"
>
<input
type=
"checkbox"
name=
"checked"
value=
"{{ user.id }}"
>
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:user-detail' pk=user.id %}"
>
{{ user.name }}
</a>
</td>
<td
class=
"text-center"
>
{{ user.username }}
</td>
<td
class=
"text-center"
>
{{ user.role.name }}
</td>
<td
class=
"text-center"
title=
"{% for user_group in user.group.all %} {{ user_group.name }} {% endfor %}"
>
{{ user.groups.all|join_queryset_attr:"name" }}
</td>
<th
class=
"text-center"
>
{{ user.name }}
</th>
<td
class=
"text-center"
>
{% if user.is_expired %}
<i
class=
"fa fa-times text-danger"
></i>
{% else %}
<i
class=
"fa fa-check text-navy"
></i>
{% endif %}
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:user-edit' pk=user.id %}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"{% url 'users:user-delete' pk=user.id %}"
class=
"btn btn-xs btn-danger del {% if user.username == 'admin' %} disabled {% endif %}"
>
删除
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div
class=
"row"
>
<div
class=
"col-sm-6"
>
</div>
{% include '_pagination.html' %}
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
apps/users/templates/users/user_list.html
浏览文件 @
f2746844
{% extends '_list_base.html' %}
{% load i18n %}
{% load common_tags %}
{% block content_left_head %}
<a
href=
"{% url 'users:user-add' %}"
class=
"btn btn-sm btn-primary "
>
添加用户
</a>
{#
<a
id=
"del_btn"
class=
"btn btn-sm btn-danger "
>
删除所选
</a>
#}
<a
href=
"{% url 'users:user-add' %}"
class=
"btn btn-sm btn-primary "
>
{% trans "Create user" %}
</a>
{% endblock %}
{% block table_head %}
<th
class=
"text-center"
>
<input
type=
"checkbox"
id=
"check_all"
onclick=
"checkAll('check_all', 'checked')"
>
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=name"
>
姓名
</a></th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=username"
>
用户名
</a></th>
<th
class=
"text-center"
>
角色
</th>
<th
class=
"text-center"
>
用户组
</th>
<th
class=
"text-center"
>
资产数量
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=date_expired"
>
有效
</a></th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=name"
>
{% trans 'Name' %}
</a></th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=username"
>
{% trans 'Username' %}
</a></th>
<th
class=
"text-center"
>
{% trans 'Role' %}
</th>
<th
class=
"text-center"
>
{% trans 'Usergroup' %}
</th>
<th
class=
"text-center"
>
{% trans 'Asset num' %}
</th>
<th
class=
"text-center"
><a
href=
"{% url 'users:user-list' %}?sort=date_expired"
>
{% trans 'Active' %}
</a></th>
<th
class=
"text-center"
></th>
{% endblock %}
...
...
@@ -41,8 +41,8 @@
{% endif %}
</td>
<td
class=
"text-center"
>
<a
href=
"{% url 'users:user-edit' pk=user.id %}"
class=
"btn btn-xs btn-info"
>
编辑
</a>
<a
href=
"{% url 'users:user-delete' pk=user.id %}"
class=
"btn btn-xs btn-danger del {% if user.id == request.user.id or user.username == 'admin' %} disabled {% endif %}"
>
删除
</a>
<a
href=
"{% url 'users:user-edit' pk=user.id %}"
class=
"btn btn-xs btn-info"
>
{% trans 'Edit' %}
</a>
<a
href=
"{% url 'users:user-delete' pk=user.id %}"
class=
"btn btn-xs btn-danger del {% if user.id == request.user.id or user.username == 'admin' %} disabled {% endif %}"
>
{% trans 'Delete' %}
</a>
</td>
</tr>
{% endfor %}
...
...
@@ -52,15 +52,15 @@
<form
id=
""
method=
"get"
action=
""
class=
" mail-search"
>
<div
class=
"input-group"
>
<select
class=
"form-control m-b"
style=
"width: auto"
>
<option>
批量删除
</option>
<option>
批量更新
</option>
<option>
批量禁用
</option>
<option>
批量导出
</option>
<option>
{% trans 'Delete selected' %}
</option>
<option>
{% trans 'Update selected' %}
</option>
<option>
{% trans 'Deactive selected' %}
</option>
<option>
{% trans 'Export selected' %}
</option>
</select>
<div
class=
"input-group-btn pull-left"
style=
"padding-left: 5px;"
>
<button
id=
'search_btn'
type=
"submit"
style=
"height: 32px;"
class=
"btn btn-sm btn-primary"
>
确认
{% trans 'Commit' %}
</button>
</div>
...
...
apps/users/utils.py
浏览文件 @
f2746844
...
...
@@ -8,6 +8,7 @@ import logging
from
paramiko.rsakey
import
RSAKey
from
django.contrib.auth.mixins
import
UserPassesTestMixin
from
django.urls
import
reverse_lazy
from
django.utils.translation
import
ugettext
as
_
from
common.tasks
import
send_mail_async
from
common.utils
import
reverse
...
...
@@ -43,7 +44,7 @@ def ssh_key_gen(length=2048, password=None, username='root', hostname=None):
f
=
StringIO
.
StringIO
()
try
:
logger
.
debug
(
'Begin to generate ssh private key ...'
)
logger
.
debug
(
_
(
'Begin to generate ssh private key ...'
)
)
private_key_obj
=
RSAKey
.
generate
(
length
)
private_key_obj
.
write_private_key
(
f
,
password
=
password
)
private_key
=
f
.
getvalue
()
...
...
@@ -55,33 +56,33 @@ def ssh_key_gen(length=2048, password=None, username='root', hostname=None):
'hostname'
:
hostname
,
}
logger
.
debug
(
'Finish to generate ssh private key ...'
)
logger
.
debug
(
_
(
'Finish to generate ssh private key ...'
)
)
return
private_key
,
public_key
except
IOError
:
raise
IOError
(
'These is error when generate ssh key.'
)
raise
IOError
(
_
(
'These is error when generate ssh key.'
)
)
def
user_add_success_next
(
user
):
subject
=
'您的用户创建成功'
subject
=
_
(
'Create account successfully'
)
recipient_list
=
[
user
.
email
]
message
=
"""
您好
%(name)s:
message
=
_
(
"""
Hello
%(name)s:
</br>
恭喜您,您的账号已经创建成功.
Your account has been created successfully
</br>
<a href="%(rest_password_url)s?token=%(rest_password_token)s">
请点击这里设置密码
</a>
<a href="%(rest_password_url)s?token=%(rest_password_token)s">
click here to set your password
</a>
</br>
这个链接有效期1小时, 超过时间您可以 <a href="%(forget_password_url)s?email=%(email)s">重新申请
</a>
This link is valid for 1 hour. After it expires, <a href="%(forget_password_url)s?email=%(email)s">request new one
</a>
</br>
---
</br>
<a href="%(login_url)s">
直接登录
</a>
<a href="%(login_url)s">
Login direct
</a>
</br>
"""
%
{
"""
)
%
{
'name'
:
user
.
name
,
'rest_password_url'
:
reverse
(
'users:reset-password'
,
external
=
True
),
'rest_password_token'
:
user
.
generate_reset_token
(),
...
...
@@ -94,25 +95,25 @@ def user_add_success_next(user):
def
send_reset_password_mail
(
user
):
subject
=
'重设密码'
subject
=
_
(
'Reset password'
)
recipient_list
=
[
user
.
email
]
message
=
"""
您好
%(name)s:
message
=
_
(
"""
Hello
%(name)s:
</br>
您好,请点击下面链接重置密码, 如果不是您申请的, 请关注账号安全
Please click the link below to reset your password, if not your request, concern your account security
</br>
<a href="%(rest_password_url)s?token=%(rest_password_token)s">
请点击这里设置密码
</a>
<a href="%(rest_password_url)s?token=%(rest_password_token)s">
Click here reset password
</a>
</br>
这个链接有效期1小时, 超过时间您可以 <a href="%(forget_password_url)s?email=%(email)s">重新申请
</a>
This link is valid for 1 hour. After it expires, <a href="%(forget_password_url)s?email=%(email)s">request new one<
</a>
</br>
---
</br>
<a href="%(login_url)s">
直接登录
</a>
<a href="%(login_url)s">
Login direct
</a>
</br>
"""
%
{
"""
)
%
{
'name'
:
user
.
name
,
'rest_password_url'
:
reverse
(
'users:reset-password'
,
external
=
True
),
'rest_password_token'
:
user
.
generate_reset_token
(),
...
...
apps/users/views.py
浏览文件 @
f2746844
...
...
@@ -5,7 +5,6 @@ from __future__ import unicode_literals
import
logging
from
django.shortcuts
import
get_object_or_404
,
reverse
,
render
,
Http404
,
redirect
from
django.http
import
HttpResponseRedirect
from
django.urls
import
reverse_lazy
from
django.utils.translation
import
ugettext
as
_
from
django.db.models
import
Q
...
...
@@ -68,8 +67,8 @@ class UserLogoutView(TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'title'
:
'退出登录成功'
,
'messages'
:
'退出登录成功, 返回登录页面'
,
'title'
:
_
(
'Logout success'
)
,
'messages'
:
_
(
'Logout success, return login page'
)
,
'redirect_url'
:
reverse
(
'users:login'
),
'auto_redirect'
:
True
,
}
...
...
@@ -98,7 +97,7 @@ class UserListView(AdminUserRequiredMixin, ListView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserListView
,
self
).
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
'用户管理'
,
'action'
:
'用户列表'
,
'keyword'
:
self
.
keyword
})
context
.
update
({
'app'
:
_
(
'Users'
),
'action'
:
_
(
'User list'
)
,
'keyword'
:
self
.
keyword
})
return
context
...
...
@@ -107,11 +106,11 @@ class UserAddView(AdminUserRequiredMixin, SuccessMessageMixin, CreateView):
form_class
=
UserAddForm
template_name
=
'users/user_add.html'
success_url
=
reverse_lazy
(
'users:user-list'
)
success_message
=
'添加用户 <a href="%s">%s</a> 成功 .'
success_message
=
_
(
'Create user<a href="%s">%s</a> success.'
)
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserAddView
,
self
).
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
'用户管理'
,
'action'
:
'用户添加'
})
context
.
update
({
'app'
:
_
(
'Users'
),
'action'
:
_
(
'Create user'
)
})
return
context
def
form_valid
(
self
,
form
):
...
...
@@ -153,7 +152,7 @@ class UserUpdateView(AdminUserRequiredMixin, UpdateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserUpdateView
,
self
).
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
'用户管理'
,
'action'
:
'用户编辑'
})
context
.
update
({
'app'
:
_
(
'Users'
),
'action'
:
_
(
'Edit user'
)
})
return
context
...
...
@@ -171,7 +170,7 @@ class UserDetailView(AdminUserRequiredMixin, DetailView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserDetailView
,
self
).
get_context_data
(
**
kwargs
)
groups
=
[
group
for
group
in
UserGroup
.
objects
.
iterator
()
if
group
not
in
self
.
object
.
groups
.
iterator
()]
context
.
update
({
'app'
:
'用户管理'
,
'action'
:
'用户详情'
,
'groups'
:
groups
})
context
.
update
({
'app'
:
_
(
'Users'
),
'action'
:
_
(
'User detail'
)
,
'groups'
:
groups
})
return
context
...
...
@@ -195,7 +194,7 @@ class UserGroupListView(AdminUserRequiredMixin, ListView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserGroupListView
,
self
).
get_context_data
(
**
kwargs
)
context
.
update
({
'app'
:
'用户管理'
,
'action'
:
'用户组列表'
,
'keyword'
:
self
.
keyword
})
context
.
update
({
'app'
:
_
(
'Users'
),
'action'
:
_
(
'Usergroup list'
)
,
'keyword'
:
self
.
keyword
})
return
context
...
...
@@ -208,7 +207,7 @@ class UserGroupAddView(AdminUserRequiredMixin, CreateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
super
(
UserGroupAddView
,
self
).
get_context_data
(
**
kwargs
)
users
=
User
.
objects
.
all
()
context
.
update
({
'app'
:
'用户管理'
,
'action'
:
'用户组添加'
,
'users'
:
users
})
context
.
update
({
'app'
:
_
(
'Users'
),
'action'
:
_
(
'Create usergroup'
)
,
'users'
:
users
})
return
context
def
form_valid
(
self
,
form
):
...
...
@@ -240,7 +239,7 @@ class UserForgetPasswordView(TemplateView):
email
=
request
.
POST
.
get
(
'email'
)
user
=
get_object_or_none
(
User
,
email
=
email
)
if
not
user
:
return
self
.
get
(
request
,
errors
=
'邮件地址错误,请重新输入'
)
return
self
.
get
(
request
,
errors
=
_
(
'Email address invalid, input again'
)
)
else
:
send_reset_password_mail
(
user
)
return
HttpResponseRedirect
(
reverse
(
'users:forget-password-sendmail-success'
))
...
...
@@ -251,8 +250,8 @@ class UserForgetPasswordSendmailSuccessView(TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'title'
:
'发送重置邮件'
,
'messages'
:
'发送重置邮件成功, 请登录邮箱查看, 按照提示操作 (如果没收到,请等待3-5分钟)'
,
'title'
:
_
(
'Send reset password message'
)
,
'messages'
:
_
(
'Send reset password mail success, login your mail box and follow it '
)
,
'redirect_url'
:
reverse
(
'users:login'
),
}
kwargs
.
update
(
context
)
...
...
@@ -264,8 +263,8 @@ class UserResetPasswordSuccessView(TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'title'
:
'重设密码成功'
,
'messages'
:
'密码重置成功, 返回登录页面 '
,
'title'
:
_
(
'Reset password success'
)
,
'messages'
:
_
(
'Reset password success, return to login page'
)
,
'redirect_url'
:
reverse
(
'users:login'
),
'auto_redirect'
:
True
,
}
...
...
@@ -281,7 +280,7 @@ class UserResetPasswordView(TemplateView):
user
=
User
.
validate_reset_token
(
token
)
if
not
user
:
kwargs
.
update
({
'errors'
:
'Token不正确或已过期'
})
kwargs
.
update
({
'errors'
:
_
(
'Token invalid or expired'
)
})
return
super
(
UserResetPasswordView
,
self
).
get
(
request
,
*
args
,
**
kwargs
)
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
...
...
@@ -290,11 +289,11 @@ class UserResetPasswordView(TemplateView):
token
=
request
.
GET
.
get
(
'token'
)
if
password
!=
password_confirm
:
return
self
.
get
(
request
,
errors
=
'两次密码不一致'
)
return
self
.
get
(
request
,
errors
=
_
(
'Password not same'
)
)
user
=
User
.
validate_reset_token
(
token
)
if
not
user
:
return
self
.
get
(
request
,
errors
=
'Token不正确或已过期'
)
return
self
.
get
(
request
,
errors
=
_
(
'Token invalid or expired'
)
)
user
.
reset_password
(
password
)
return
HttpResponseRedirect
(
reverse
(
'users:reset-password-success'
))
config-example.py
浏览文件 @
f2746844
...
...
@@ -23,6 +23,7 @@ class Config:
# It's used to identify your site, When we send a create mail to user, we only know login url is /login/
# But we should know the absolute url like: http://jms.jumpserver.org/login/, so SITE_URL is
# HTTP_PROTOCOL://HOST[:PORT]
# Todo: May be use :method: get_current_site more grace, bug restful api unknown ok or not
SITE_URL
=
'http://localhost'
# Django security setting, if your disable debug model, you should setting that
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录