diff --git a/apps/i18n/zh/LC_MESSAGES/django.mo b/apps/i18n/zh/LC_MESSAGES/django.mo index 78705cf79..ace72c44b 100644 Binary files a/apps/i18n/zh/LC_MESSAGES/django.mo and b/apps/i18n/zh/LC_MESSAGES/django.mo differ diff --git a/apps/i18n/zh/LC_MESSAGES/django.po b/apps/i18n/zh/LC_MESSAGES/django.po index eb42e1bef..cc9ee531d 100644 --- a/apps/i18n/zh/LC_MESSAGES/django.po +++ b/apps/i18n/zh/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Jumpserver 0.3.3\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-05 17:03+0800\n" +"POT-Creation-Date: 2018-06-06 16:53+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: ibuler \n" "Language-Team: Jumpserver team\n" @@ -17,19 +17,19 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: assets/api/node.py:106 +#: assets/api/node.py:99 msgid "New node {}" msgstr "新节点 {}" -#: assets/api/node.py:241 +#: assets/api/node.py:234 msgid "更新节点资产硬件信息: {}" msgstr "" -#: assets/api/node.py:254 +#: assets/api/node.py:247 msgid "测试节点下资产是否可连接: {}" msgstr "" -#: assets/forms/asset.py:24 assets/models/asset.py:74 assets/models/user.py:103 +#: assets/forms/asset.py:24 assets/models/asset.py:75 assets/models/user.py:103 #: assets/templates/assets/asset_detail.html:183 #: assets/templates/assets/asset_detail.html:191 #: assets/templates/assets/system_user_detail.html:175 perms/models.py:33 @@ -37,7 +37,7 @@ msgid "Nodes" msgstr "节点管理" #: assets/forms/asset.py:27 assets/forms/asset.py:66 assets/forms/asset.py:109 -#: assets/forms/asset.py:113 assets/models/asset.py:79 +#: assets/forms/asset.py:113 assets/models/asset.py:80 #: assets/models/cluster.py:19 assets/models/user.py:72 #: assets/templates/assets/asset_detail.html:73 templates/_nav.html:25 msgid "Admin user" @@ -53,7 +53,7 @@ msgstr "管理用户" msgid "Label" msgstr "标签" -#: assets/forms/asset.py:34 assets/forms/asset.py:73 assets/models/asset.py:70 +#: assets/forms/asset.py:34 assets/forms/asset.py:73 assets/models/asset.py:71 #: assets/models/domain.py:46 msgid "Domain" msgstr "网域" @@ -90,7 +90,7 @@ msgstr "如果有多个的互相隔离的网络,设置资产属于的网域, msgid "Select assets" msgstr "选择资产" -#: assets/forms/asset.py:105 assets/models/asset.py:66 +#: assets/forms/asset.py:105 assets/models/asset.py:67 #: assets/models/domain.py:44 assets/templates/assets/admin_user_assets.html:53 #: assets/templates/assets/asset_detail.html:69 #: assets/templates/assets/domain_gateway_list.html:58 @@ -99,7 +99,7 @@ msgid "Port" msgstr "端口" #: assets/forms/domain.py:14 assets/forms/label.py:13 -#: assets/models/asset.py:229 assets/templates/assets/admin_user_list.html:25 +#: assets/models/asset.py:223 assets/templates/assets/admin_user_list.html:25 #: assets/templates/assets/domain_detail.html:60 #: assets/templates/assets/domain_list.html:15 #: assets/templates/assets/label_list.html:16 @@ -136,8 +136,8 @@ msgstr "资产" #: perms/templates/perms/asset_permission_list.html:53 #: perms/templates/perms/asset_permission_user.html:54 terminal/models.py:16 #: terminal/models.py:154 terminal/templates/terminal/terminal_detail.html:43 -#: terminal/templates/terminal/terminal_list.html:29 users/models/group.py:14 -#: users/models/user.py:42 users/templates/users/_select_user_modal.html:13 +#: terminal/templates/terminal/terminal_list.html:29 users/models/group.py:12 +#: users/models/user.py:49 users/templates/users/_select_user_modal.html:13 #: users/templates/users/user_detail.html:63 #: users/templates/users/user_group_detail.html:55 #: users/templates/users/user_group_list.html:12 @@ -155,7 +155,7 @@ msgstr "名称" #: assets/templates/assets/system_user_list.html:27 #: perms/templates/perms/asset_permission_user.html:55 users/forms.py:13 #: users/forms.py:21 users/forms.py:30 users/models/authentication.py:45 -#: users/models/user.py:40 users/templates/users/_select_user_modal.html:14 +#: users/models/user.py:47 users/templates/users/_select_user_modal.html:14 #: users/templates/users/login.html:56 #: users/templates/users/login_log_list.html:49 #: users/templates/users/user_detail.html:67 @@ -180,7 +180,7 @@ msgstr "密码或密钥密码" msgid "Password" msgstr "密码" -#: assets/forms/user.py:28 users/models/user.py:69 +#: assets/forms/user.py:28 users/models/user.py:76 msgid "Private key" msgstr "ssh私钥" @@ -202,7 +202,7 @@ msgid "" "than 2 system user" msgstr "高优先级的系统用户将会作为默认登录用户" -#: assets/models/asset.py:62 assets/models/domain.py:43 +#: assets/models/asset.py:63 assets/models/domain.py:43 #: assets/templates/assets/_asset_list_modal.html:46 #: assets/templates/assets/admin_user_assets.html:52 #: assets/templates/assets/asset_detail.html:61 @@ -217,7 +217,7 @@ msgstr "高优先级的系统用户将会作为默认登录用户" msgid "IP" msgstr "IP" -#: assets/models/asset.py:65 assets/templates/assets/_asset_list_modal.html:45 +#: assets/models/asset.py:66 assets/templates/assets/_asset_list_modal.html:45 #: assets/templates/assets/admin_user_assets.html:51 #: assets/templates/assets/asset_detail.html:57 #: assets/templates/assets/asset_list.html:86 @@ -229,82 +229,82 @@ msgstr "IP" msgid "Hostname" msgstr "主机名" -#: assets/models/asset.py:68 assets/templates/assets/asset_detail.html:97 +#: assets/models/asset.py:69 assets/templates/assets/asset_detail.html:97 msgid "Platform" msgstr "系统平台" -#: assets/models/asset.py:75 assets/models/domain.py:48 +#: assets/models/asset.py:76 assets/models/domain.py:48 #: assets/models/label.py:20 assets/templates/assets/asset_detail.html:105 msgid "Is active" msgstr "激活" -#: assets/models/asset.py:84 assets/templates/assets/asset_detail.html:65 +#: assets/models/asset.py:85 assets/templates/assets/asset_detail.html:65 msgid "Public IP" msgstr "公网IP" -#: assets/models/asset.py:86 assets/templates/assets/asset_detail.html:113 +#: assets/models/asset.py:87 assets/templates/assets/asset_detail.html:113 msgid "Asset number" msgstr "资产编号" -#: assets/models/asset.py:90 assets/templates/assets/asset_detail.html:77 +#: assets/models/asset.py:91 assets/templates/assets/asset_detail.html:77 msgid "Vendor" msgstr "制造商" -#: assets/models/asset.py:92 assets/templates/assets/asset_detail.html:81 +#: assets/models/asset.py:93 assets/templates/assets/asset_detail.html:81 msgid "Model" msgstr "型号" -#: assets/models/asset.py:94 assets/templates/assets/asset_detail.html:109 +#: assets/models/asset.py:95 assets/templates/assets/asset_detail.html:109 msgid "Serial number" msgstr "序列号" -#: assets/models/asset.py:97 +#: assets/models/asset.py:98 msgid "CPU model" msgstr "CPU型号" -#: assets/models/asset.py:98 +#: assets/models/asset.py:99 msgid "CPU count" msgstr "CPU数量" -#: assets/models/asset.py:99 +#: assets/models/asset.py:100 msgid "CPU cores" msgstr "CPU核数" -#: assets/models/asset.py:101 assets/templates/assets/asset_detail.html:89 +#: assets/models/asset.py:102 assets/templates/assets/asset_detail.html:89 msgid "Memory" msgstr "内存" -#: assets/models/asset.py:103 +#: assets/models/asset.py:104 msgid "Disk total" msgstr "硬盘大小" -#: assets/models/asset.py:105 +#: assets/models/asset.py:106 msgid "Disk info" msgstr "硬盘信息" -#: assets/models/asset.py:108 assets/templates/assets/asset_detail.html:101 +#: assets/models/asset.py:109 assets/templates/assets/asset_detail.html:101 msgid "OS" msgstr "操作系统" -#: assets/models/asset.py:110 +#: assets/models/asset.py:111 msgid "OS version" msgstr "系统版本" -#: assets/models/asset.py:112 +#: assets/models/asset.py:113 msgid "OS arch" msgstr "系统架构" -#: assets/models/asset.py:114 +#: assets/models/asset.py:115 msgid "Hostname raw" msgstr "主机名原始" -#: assets/models/asset.py:118 assets/templates/assets/asset_create.html:33 +#: assets/models/asset.py:119 assets/templates/assets/asset_create.html:33 #: assets/templates/assets/asset_detail.html:220 #: assets/templates/assets/asset_update.html:38 templates/_nav.html:27 msgid "Labels" msgstr "标签管理" -#: assets/models/asset.py:120 assets/models/base.py:29 +#: assets/models/asset.py:121 assets/models/base.py:29 #: assets/models/cluster.py:28 assets/models/group.py:21 #: assets/templates/assets/admin_user_detail.html:68 #: assets/templates/assets/asset_detail.html:117 @@ -312,11 +312,11 @@ msgstr "标签管理" #: assets/templates/assets/system_user_detail.html:96 #: ops/templates/ops/adhoc_detail.html:86 perms/models.py:38 perms/models.py:81 #: perms/templates/perms/asset_permission_detail.html:98 -#: users/models/user.py:83 users/templates/users/user_detail.html:107 +#: users/models/user.py:90 users/templates/users/user_detail.html:111 msgid "Created by" msgstr "创建者" -#: assets/models/asset.py:123 assets/models/cluster.py:26 +#: assets/models/asset.py:124 assets/models/cluster.py:26 #: assets/models/domain.py:20 assets/models/group.py:22 #: assets/models/label.py:23 assets/templates/assets/admin_user_detail.html:64 #: assets/templates/assets/domain_detail.html:68 @@ -324,12 +324,12 @@ msgstr "创建者" #: ops/templates/ops/adhoc_detail.html:90 ops/templates/ops/task_detail.html:63 #: perms/models.py:39 perms/models.py:82 #: perms/templates/perms/asset_permission_detail.html:94 -#: terminal/templates/terminal/terminal_detail.html:59 users/models/group.py:17 +#: terminal/templates/terminal/terminal_detail.html:59 users/models/group.py:15 #: users/templates/users/user_group_detail.html:63 msgid "Date created" msgstr "创建日期" -#: assets/models/asset.py:125 assets/models/base.py:26 +#: assets/models/asset.py:126 assets/models/base.py:26 #: assets/models/cluster.py:29 assets/models/domain.py:18 #: assets/models/domain.py:47 assets/models/group.py:23 #: assets/models/label.py:21 assets/templates/assets/admin_user_detail.html:72 @@ -342,11 +342,11 @@ msgstr "创建日期" #: assets/templates/assets/system_user_list.html:33 common/models.py:30 #: ops/models/adhoc.py:42 perms/models.py:40 perms/models.py:83 #: perms/templates/perms/asset_permission_detail.html:102 terminal/models.py:26 -#: terminal/templates/terminal/terminal_detail.html:63 users/models/group.py:15 -#: users/models/user.py:75 users/templates/users/user_detail.html:119 +#: terminal/templates/terminal/terminal_detail.html:63 users/models/group.py:13 +#: users/models/user.py:82 users/templates/users/user_detail.html:123 #: users/templates/users/user_group_detail.html:67 #: users/templates/users/user_group_list.html:14 -#: users/templates/users/user_profile.html:126 +#: users/templates/users/user_profile.html:130 msgid "Comment" msgstr "备注" @@ -366,7 +366,7 @@ msgstr "带宽" msgid "Contact" msgstr "联系人" -#: assets/models/cluster.py:22 users/models/user.py:61 +#: assets/models/cluster.py:22 users/models/user.py:68 #: users/templates/users/user_detail.html:76 msgid "Phone" msgstr "手机" @@ -392,7 +392,7 @@ msgid "Default" msgstr "默认" #: assets/models/cluster.py:36 assets/models/label.py:13 -#: users/models/user.py:330 +#: users/models/user.py:347 msgid "System" msgstr "系统" @@ -432,9 +432,9 @@ msgstr "默认资产组" #: terminal/templates/terminal/command_list.html:72 #: terminal/templates/terminal/session_list.html:33 #: terminal/templates/terminal/session_list.html:71 users/forms.py:281 -#: users/models/user.py:30 users/models/user.py:318 +#: users/models/user.py:31 users/models/user.py:335 #: users/templates/users/user_group_detail.html:78 -#: users/templates/users/user_group_list.html:13 users/views/user.py:360 +#: users/templates/users/user_group_list.html:13 users/views/user.py:359 msgid "User" msgstr "用户" @@ -640,7 +640,7 @@ msgstr "其它" #: users/templates/users/_user.html:46 #: users/templates/users/user_bulk_update.html:23 #: users/templates/users/user_password_update.html:70 -#: users/templates/users/user_profile.html:184 +#: users/templates/users/user_profile.html:188 #: users/templates/users/user_profile_update.html:63 #: users/templates/users/user_pubkey_update.html:70 #: users/templates/users/user_pubkey_update.html:76 @@ -667,7 +667,7 @@ msgstr "重置" #: users/templates/users/_user.html:47 #: users/templates/users/forgot_password.html:44 #: users/templates/users/user_bulk_update.html:24 -#: users/templates/users/user_list.html:44 +#: users/templates/users/user_list.html:45 #: users/templates/users/user_password_update.html:71 #: users/templates/users/user_profile_update.html:64 #: users/templates/users/user_pubkey_update.html:77 @@ -744,9 +744,9 @@ msgstr "测试" #: users/templates/users/user_detail.html:25 #: users/templates/users/user_group_detail.html:28 #: users/templates/users/user_group_list.html:43 -#: users/templates/users/user_list.html:76 -#: users/templates/users/user_profile.html:147 -#: users/templates/users/user_profile.html:176 +#: users/templates/users/user_list.html:77 +#: users/templates/users/user_profile.html:151 +#: users/templates/users/user_profile.html:180 msgid "Update" msgstr "更新" @@ -768,8 +768,8 @@ msgstr "更新" #: users/templates/users/user_detail.html:30 #: users/templates/users/user_group_detail.html:32 #: users/templates/users/user_group_list.html:45 -#: users/templates/users/user_list.html:80 -#: users/templates/users/user_list.html:84 +#: users/templates/users/user_list.html:81 +#: users/templates/users/user_list.html:85 msgid "Delete" msgstr "删除" @@ -784,17 +784,17 @@ msgstr "选择节点" #: assets/templates/assets/admin_user_detail.html:100 #: assets/templates/assets/asset_detail.html:200 -#: assets/templates/assets/asset_list.html:639 +#: assets/templates/assets/asset_list.html:638 #: assets/templates/assets/system_user_detail.html:192 #: assets/templates/assets/system_user_list.html:138 templates/_modal.html:22 #: terminal/templates/terminal/session_detail.html:108 -#: users/templates/users/user_detail.html:362 -#: users/templates/users/user_detail.html:387 -#: users/templates/users/user_detail.html:410 +#: users/templates/users/user_detail.html:366 +#: users/templates/users/user_detail.html:391 +#: users/templates/users/user_detail.html:414 #: users/templates/users/user_group_create_update.html:32 #: users/templates/users/user_group_list.html:86 -#: users/templates/users/user_list.html:199 -#: users/templates/users/user_profile.html:218 +#: users/templates/users/user_list.html:200 +#: users/templates/users/user_profile.html:222 msgid "Confirm" msgstr "确认" @@ -827,7 +827,7 @@ msgstr "比例" #: terminal/templates/terminal/session_list.html:80 #: terminal/templates/terminal/terminal_list.html:36 #: users/templates/users/user_group_list.html:15 -#: users/templates/users/user_list.html:28 +#: users/templates/users/user_list.html:29 msgid "Action" msgstr "动作" @@ -844,15 +844,15 @@ msgid "Disk" msgstr "硬盘" #: assets/templates/assets/asset_detail.html:121 -#: users/templates/users/user_detail.html:111 -#: users/templates/users/user_profile.html:100 +#: users/templates/users/user_detail.html:115 +#: users/templates/users/user_profile.html:104 msgid "Date joined" msgstr "创建日期" #: assets/templates/assets/asset_detail.html:137 #: terminal/templates/terminal/session_detail.html:81 -#: users/templates/users/user_detail.html:130 -#: users/templates/users/user_profile.html:138 +#: users/templates/users/user_detail.html:134 +#: users/templates/users/user_profile.html:142 msgid "Quick modify" msgstr "快速修改" @@ -865,10 +865,10 @@ msgstr "快速修改" #: perms/templates/perms/asset_permission_list.html:59 #: terminal/templates/terminal/terminal_list.html:34 #: users/templates/users/_select_user_modal.html:18 -#: users/templates/users/user_detail.html:136 +#: users/templates/users/user_detail.html:140 #: users/templates/users/user_granted_asset.html:46 #: users/templates/users/user_group_granted_asset.html:46 -#: users/templates/users/user_list.html:27 +#: users/templates/users/user_list.html:28 #: users/templates/users/user_profile.html:63 msgid "Active" msgstr "激活中" @@ -882,8 +882,8 @@ msgid "Refresh" msgstr "刷新" #: assets/templates/assets/asset_detail.html:300 -#: users/templates/users/user_detail.html:282 -#: users/templates/users/user_detail.html:309 +#: users/templates/users/user_detail.html:286 +#: users/templates/users/user_detail.html:313 msgid "Update successfully!" msgstr "更新成功" @@ -906,12 +906,12 @@ msgid "Hardware" msgstr "硬件" #: assets/templates/assets/asset_list.html:100 -#: users/templates/users/user_list.html:37 +#: users/templates/users/user_list.html:38 msgid "Delete selected" msgstr "批量删除" #: assets/templates/assets/asset_list.html:101 -#: users/templates/users/user_list.html:38 +#: users/templates/users/user_list.html:39 msgid "Update selected" msgstr "批量更新" @@ -920,12 +920,12 @@ msgid "Remove from this node" msgstr "从节点移除" #: assets/templates/assets/asset_list.html:103 -#: users/templates/users/user_list.html:39 +#: users/templates/users/user_list.html:40 msgid "Deactive selected" msgstr "禁用所选" #: assets/templates/assets/asset_list.html:104 -#: users/templates/users/user_list.html:40 +#: users/templates/users/user_list.html:41 msgid "Active selected" msgstr "激活所选" @@ -977,29 +977,29 @@ msgstr "存在子节点,不能删除" msgid "Have assets, cancel" msgstr "存在资产,不能删除" -#: assets/templates/assets/asset_list.html:634 +#: assets/templates/assets/asset_list.html:633 #: assets/templates/assets/system_user_list.html:133 -#: users/templates/users/user_detail.html:357 -#: users/templates/users/user_detail.html:382 +#: users/templates/users/user_detail.html:361 +#: users/templates/users/user_detail.html:386 #: users/templates/users/user_group_list.html:81 -#: users/templates/users/user_list.html:194 +#: users/templates/users/user_list.html:195 msgid "Are you sure?" msgstr "你确认吗?" -#: assets/templates/assets/asset_list.html:635 +#: assets/templates/assets/asset_list.html:634 msgid "This will delete the selected assets !!!" msgstr "删除选择资产" -#: assets/templates/assets/asset_list.html:643 +#: assets/templates/assets/asset_list.html:642 msgid "Asset Deleted." msgstr "已被删除" -#: assets/templates/assets/asset_list.html:644 -#: assets/templates/assets/asset_list.html:649 +#: assets/templates/assets/asset_list.html:643 +#: assets/templates/assets/asset_list.html:648 msgid "Asset Delete" msgstr "删除" -#: assets/templates/assets/asset_list.html:648 +#: assets/templates/assets/asset_list.html:647 msgid "Asset Deleting failed." msgstr "删除失败" @@ -1239,11 +1239,11 @@ msgstr "FTP日志" msgid "Test mail sent to {}, please check" msgstr "邮件已经发送{}, 请检查" -#: common/api.py:52 +#: common/api.py:42 msgid "Test ldap success" msgstr "连接LDAP成功" -#: common/api.py:90 +#: common/api.py:80 msgid "Match {} s users" msgstr "匹配 {} 个用户" @@ -1414,41 +1414,41 @@ msgstr "开启后,用户登录必须使用MFA二次认证(对所有用户有 msgid "Password minimum length" msgstr "密码最小长度 " -#: common/forms.py:190 +#: common/forms.py:191 msgid "Must contain capital letters" msgstr "必须包含大写字母" -#: common/forms.py:192 +#: common/forms.py:193 msgid "" "After opening, the user password changes and resets must contain uppercase " "letters" msgstr "开启后,用户密码修改、重置必须包含大写字母" -#: common/forms.py:198 +#: common/forms.py:199 msgid "Must contain lowercase letters" msgstr "必须包含小写字母" -#: common/forms.py:199 +#: common/forms.py:200 msgid "" "After opening, the user password changes and resets must contain lowercase " "letters" msgstr "开启后,用户密码修改、重置必须包含小写字母" -#: common/forms.py:205 +#: common/forms.py:206 msgid "Must contain numeric characters" msgstr "必须包含数字字符" -#: common/forms.py:206 +#: common/forms.py:207 msgid "" "After opening, the user password changes and resets must contain numeric " "characters" msgstr "开启后,用户密码修改、重置必须包含数字字符" -#: common/forms.py:212 +#: common/forms.py:213 msgid "Must contain special characters" msgstr "必须包含特殊字符" -#: common/forms.py:213 +#: common/forms.py:214 msgid "" "After opening, the user password changes and resets must contain special " "characters" @@ -1813,9 +1813,9 @@ msgstr "选择用户" #: perms/forms.py:34 perms/models.py:31 perms/models.py:77 #: perms/templates/perms/asset_permission_list.html:55 #: perms/templates/perms/asset_permission_list.html:136 templates/_nav.html:14 -#: users/models/group.py:25 users/models/user.py:48 +#: users/models/group.py:23 users/models/user.py:55 #: users/templates/users/_select_user_modal.html:16 -#: users/templates/users/user_detail.html:188 +#: users/templates/users/user_detail.html:192 #: users/templates/users/user_list.html:26 msgid "User group" msgstr "用户组" @@ -1830,8 +1830,8 @@ msgstr "" #: perms/models.py:37 perms/models.py:80 #: perms/templates/perms/asset_permission_detail.html:90 -#: users/models/user.py:80 users/templates/users/user_detail.html:103 -#: users/templates/users/user_profile.html:108 +#: users/models/user.py:87 users/templates/users/user_detail.html:107 +#: users/templates/users/user_profile.html:112 msgid "Date expired" msgstr "失效日期" @@ -1868,7 +1868,7 @@ msgid "Add node to this permission" msgstr "添加节点" #: perms/templates/perms/asset_permission_asset.html:125 -#: users/templates/users/user_detail.html:205 +#: users/templates/users/user_detail.html:209 msgid "Join" msgstr "加入" @@ -1965,7 +1965,7 @@ msgstr "文档" #: users/templates/users/user_profile.html:17 #: users/templates/users/user_profile_update.html:37 #: users/templates/users/user_profile_update.html:57 -#: users/templates/users/user_pubkey_update.html:37 users/views/user.py:342 +#: users/templates/users/user_pubkey_update.html:37 users/views/user.py:341 msgid "Profile" msgstr "个人信息" @@ -2022,9 +2022,9 @@ msgstr "关闭" #: templates/_nav.html:10 users/views/group.py:28 users/views/group.py:44 #: users/views/group.py:62 users/views/group.py:79 users/views/group.py:95 -#: users/views/login.py:284 users/views/login.py:342 users/views/user.py:65 +#: users/views/login.py:277 users/views/login.py:335 users/views/user.py:65 #: users/views/user.py:80 users/views/user.py:102 users/views/user.py:173 -#: users/views/user.py:328 users/views/user.py:379 users/views/user.py:414 +#: users/views/user.py:328 users/views/user.py:378 users/views/user.py:413 msgid "Users" msgstr "用户管理" @@ -2338,7 +2338,7 @@ msgstr "" msgid "MFA code" msgstr "MFA 验证码" -#: users/forms.py:49 users/models/user.py:52 +#: users/forms.py:49 users/models/user.py:59 #: users/templates/users/_select_user_modal.html:15 #: users/templates/users/user_detail.html:87 #: users/templates/users/user_list.html:25 @@ -2358,7 +2358,7 @@ msgstr "" msgid "Paste user id_rsa.pub here." msgstr "复制用户公钥到这里" -#: users/forms.py:72 users/templates/users/user_detail.html:196 +#: users/forms.py:72 users/templates/users/user_detail.html:200 msgid "Join user groups" msgstr "添加到用户组" @@ -2366,7 +2366,7 @@ msgstr "添加到用户组" msgid "Public key should not be the same as your old one." msgstr "不能和原来的密钥相同" -#: users/forms.py:87 users/forms.py:220 users/serializers.py:45 +#: users/forms.py:87 users/forms.py:220 users/serializers.py:48 msgid "Not a valid ssh public key" msgstr "ssh密钥不合法" @@ -2383,7 +2383,7 @@ msgstr "" msgid "* Enable MFA authentication to make the account more secure." msgstr "* 启用MFA认证,使账号更加安全." -#: users/forms.py:142 users/models/user.py:64 +#: users/forms.py:142 users/models/user.py:71 #: users/templates/users/first_login.html:45 msgid "MFA" msgstr "MFA" @@ -2431,7 +2431,7 @@ msgstr "自动配置并下载SSH密钥" msgid "Paste your id_rsa.pub here." msgstr "复制你的公钥到这里" -#: users/forms.py:231 users/models/user.py:72 +#: users/forms.py:231 users/models/user.py:79 #: users/templates/users/first_login.html:42 #: users/templates/users/user_password_update.html:45 #: users/templates/users/user_profile.html:68 @@ -2464,43 +2464,49 @@ msgstr "Agent" msgid "Date login" msgstr "登录日期" -#: users/models/user.py:29 users/models/user.py:326 +#: users/models/user.py:30 users/models/user.py:343 msgid "Administrator" msgstr "管理员" -#: users/models/user.py:31 +#: users/models/user.py:32 msgid "Application" msgstr "应用程序" -#: users/models/user.py:34 users/templates/users/user_profile.html:92 -#: users/templates/users/user_profile.html:159 -#: users/templates/users/user_profile.html:162 +#: users/models/user.py:35 users/templates/users/user_profile.html:92 +#: users/templates/users/user_profile.html:163 +#: users/templates/users/user_profile.html:166 msgid "Disable" msgstr "禁用" -#: users/models/user.py:35 users/templates/users/user_profile.html:90 -#: users/templates/users/user_profile.html:166 +#: users/models/user.py:36 users/templates/users/user_profile.html:90 +#: users/templates/users/user_profile.html:170 msgid "Enable" msgstr "启用" -#: users/models/user.py:36 users/templates/users/user_profile.html:88 +#: users/models/user.py:37 users/templates/users/user_profile.html:88 msgid "Force enable" msgstr "强制启用" -#: users/models/user.py:44 users/templates/users/user_detail.html:71 +#: users/models/user.py:51 users/templates/users/user_detail.html:71 #: users/templates/users/user_profile.html:59 msgid "Email" msgstr "邮件" -#: users/models/user.py:55 +#: users/models/user.py:62 msgid "Avatar" msgstr "头像" -#: users/models/user.py:58 users/templates/users/user_detail.html:82 +#: users/models/user.py:65 users/templates/users/user_detail.html:82 msgid "Wechat" msgstr "微信" -#: users/models/user.py:329 +#: users/models/user.py:94 users/templates/users/user_detail.html:103 +#: users/templates/users/user_list.html:27 +#: users/templates/users/user_profile.html:100 +msgid "Source" +msgstr "用户来源" + +#: users/models/user.py:346 msgid "Administrator is the super user of system" msgstr "Administrator是初始的超级管理员" @@ -2617,7 +2623,7 @@ msgid "Can't provide security? Please contact the administrator!" msgstr "如果不能提供MFA验证码,请联系管理员!" #: users/templates/users/reset_password.html:46 -#: users/templates/users/user_detail.html:348 users/utils.py:80 +#: users/templates/users/user_detail.html:352 users/utils.py:80 msgid "Reset password" msgstr "重置密码" @@ -2671,63 +2677,63 @@ msgstr "强制启用" msgid "Disabled" msgstr "禁用" -#: users/templates/users/user_detail.html:115 -#: users/templates/users/user_profile.html:104 +#: users/templates/users/user_detail.html:119 +#: users/templates/users/user_profile.html:108 msgid "Last login" msgstr "最后登录" -#: users/templates/users/user_detail.html:151 +#: users/templates/users/user_detail.html:155 msgid "Force enabled MFA" msgstr "强制启用MFA" -#: users/templates/users/user_detail.html:166 +#: users/templates/users/user_detail.html:170 msgid "Send reset password mail" msgstr "发送重置密码邮件" -#: users/templates/users/user_detail.html:169 -#: users/templates/users/user_detail.html:177 +#: users/templates/users/user_detail.html:173 +#: users/templates/users/user_detail.html:181 msgid "Send" msgstr "发送" -#: users/templates/users/user_detail.html:174 +#: users/templates/users/user_detail.html:178 msgid "Send reset ssh key mail" msgstr "发送重置密钥邮件" -#: users/templates/users/user_detail.html:291 +#: users/templates/users/user_detail.html:295 msgid "Goto profile page enable MFA" msgstr "请去个人信息页面启用自己的MFA" -#: users/templates/users/user_detail.html:347 +#: users/templates/users/user_detail.html:351 msgid "An e-mail has been sent to the user`s mailbox." msgstr "已发送邮件到用户邮箱" -#: users/templates/users/user_detail.html:358 +#: users/templates/users/user_detail.html:362 msgid "This will reset the user password and send a reset mail" msgstr "将失效用户当前密码,并发送重设密码邮件到用户邮箱" -#: users/templates/users/user_detail.html:372 +#: users/templates/users/user_detail.html:376 msgid "" "The reset-ssh-public-key E-mail has been sent successfully. Please inform " "the user to update his new ssh public key." msgstr "重设密钥邮件将会发送到用户邮箱" -#: users/templates/users/user_detail.html:373 +#: users/templates/users/user_detail.html:377 msgid "Reset SSH public key" msgstr "重置SSH密钥" -#: users/templates/users/user_detail.html:383 +#: users/templates/users/user_detail.html:387 msgid "This will reset the user public key and send a reset mail" msgstr "将会失效用户当前密钥,并发送重置邮件到用户邮箱" -#: users/templates/users/user_detail.html:400 -#: users/templates/users/user_profile.html:207 +#: users/templates/users/user_detail.html:404 +#: users/templates/users/user_profile.html:211 msgid "Successfully updated the SSH public key." msgstr "更新ssh密钥成功" -#: users/templates/users/user_detail.html:401 #: users/templates/users/user_detail.html:405 -#: users/templates/users/user_profile.html:208 -#: users/templates/users/user_profile.html:213 +#: users/templates/users/user_detail.html:409 +#: users/templates/users/user_profile.html:212 +#: users/templates/users/user_profile.html:217 msgid "User SSH public key update" msgstr "ssh密钥" @@ -2766,20 +2772,20 @@ msgstr "用户组删除" msgid "UserGroup Deleting failed." msgstr "用户组删除失败" -#: users/templates/users/user_list.html:195 +#: users/templates/users/user_list.html:196 msgid "This will delete the selected users !!!" msgstr "删除选中用户 !!!" -#: users/templates/users/user_list.html:203 +#: users/templates/users/user_list.html:204 msgid "User Deleted." msgstr "已被删除" -#: users/templates/users/user_list.html:204 -#: users/templates/users/user_list.html:209 +#: users/templates/users/user_list.html:205 +#: users/templates/users/user_list.html:210 msgid "User Delete" msgstr "删除" -#: users/templates/users/user_list.html:208 +#: users/templates/users/user_list.html:209 msgid "User Deleting failed." msgstr "用户删除失败" @@ -2787,28 +2793,28 @@ msgstr "用户删除失败" msgid "Administrator Settings force MFA login" msgstr "管理员设置强制使用MFA登录" -#: users/templates/users/user_profile.html:112 users/views/user.py:203 +#: users/templates/users/user_profile.html:116 users/views/user.py:203 #: users/views/user.py:257 msgid "User groups" msgstr "用户组" -#: users/templates/users/user_profile.html:144 +#: users/templates/users/user_profile.html:148 msgid "Update password" msgstr "更改密码" -#: users/templates/users/user_profile.html:152 +#: users/templates/users/user_profile.html:156 msgid "Update MFA settings" msgstr "更改MFA设置" -#: users/templates/users/user_profile.html:173 +#: users/templates/users/user_profile.html:177 msgid "Update SSH public key" msgstr "更改SSH密钥" -#: users/templates/users/user_profile.html:181 +#: users/templates/users/user_profile.html:185 msgid "Reset public key and download" msgstr "重置并下载SSH密钥" -#: users/templates/users/user_profile.html:211 +#: users/templates/users/user_profile.html:215 msgid "Failed to update SSH public key." msgstr "更新密钥失败" @@ -2986,56 +2992,56 @@ msgstr "用户组授权资产" msgid "Please enable cookies and try again." msgstr "设置你的浏览器支持cookie" -#: users/views/login.py:135 users/views/user.py:499 users/views/user.py:524 +#: users/views/login.py:128 users/views/user.py:498 users/views/user.py:523 msgid "MFA code invalid" msgstr "MFA码认证失败" -#: users/views/login.py:161 +#: users/views/login.py:154 msgid "Logout success" msgstr "退出登录成功" -#: users/views/login.py:162 +#: users/views/login.py:155 msgid "Logout success, return login page" msgstr "退出登录成功,返回到登录页面" -#: users/views/login.py:178 +#: users/views/login.py:171 msgid "Email address invalid, please input again" msgstr "邮箱地址错误,重新输入" -#: users/views/login.py:191 +#: users/views/login.py:184 msgid "Send reset password message" msgstr "发送重置密码邮件" -#: users/views/login.py:192 +#: users/views/login.py:185 msgid "Send reset password mail success, login your mail box and follow it " msgstr "" "发送重置邮件成功, 请登录邮箱查看, 按照提示操作 (如果没收到,请等待3-5分钟)" -#: users/views/login.py:205 +#: users/views/login.py:198 msgid "Reset password success" msgstr "重置密码成功" -#: users/views/login.py:206 +#: users/views/login.py:199 msgid "Reset password success, return to login page" msgstr "重置密码成功,返回到登录页面" -#: users/views/login.py:227 users/views/login.py:240 +#: users/views/login.py:220 users/views/login.py:233 msgid "Token invalid or expired" msgstr "Token错误或失效" -#: users/views/login.py:236 +#: users/views/login.py:229 msgid "Password not same" msgstr "密码不一致" -#: users/views/login.py:246 users/views/user.py:115 users/views/user.py:397 +#: users/views/login.py:239 users/views/user.py:115 users/views/user.py:396 msgid "* Your password does not meet the requirements" msgstr "* 您的密码不符合要求" -#: users/views/login.py:284 +#: users/views/login.py:277 msgid "First login" msgstr "首次登陆" -#: users/views/login.py:343 +#: users/views/login.py:336 msgid "Login log list" msgstr "登录日志" @@ -3051,34 +3057,34 @@ msgstr "文件不合法" msgid "User granted assets" msgstr "用户授权资产" -#: users/views/user.py:361 +#: users/views/user.py:360 msgid "Profile setting" msgstr "个人信息设置" -#: users/views/user.py:380 +#: users/views/user.py:379 msgid "Password update" msgstr "密码更新" -#: users/views/user.py:415 +#: users/views/user.py:414 msgid "Public key update" msgstr "密钥更新" -#: users/views/user.py:456 +#: users/views/user.py:455 msgid "Password invalid" msgstr "用户名或密码无效" -#: users/views/user.py:550 +#: users/views/user.py:549 msgid "MFA enable success" msgstr "MFA 绑定成功" -#: users/views/user.py:551 +#: users/views/user.py:550 msgid "MFA enable success, return login page" msgstr "MFA 绑定成功,返回到登录页面" -#: users/views/user.py:553 +#: users/views/user.py:552 msgid "MFA disable success" msgstr "MFA 解绑成功" -#: users/views/user.py:554 +#: users/views/user.py:553 msgid "MFA disable success, return login page" msgstr "MFA 解绑成功,返回登录页面" diff --git a/apps/users/models/user.py b/apps/users/models/user.py index fa01ba82c..d69151f55 100644 --- a/apps/users/models/user.py +++ b/apps/users/models/user.py @@ -36,6 +36,12 @@ class User(AbstractUser): (1, _('Enable')), (2, _("Force enable")), ) + SOURCE_LOCAL = 'local' + SOURCE_LDAP = 'ldap' + SOURCE_CHOICES = ( + (SOURCE_LOCAL, 'Local'), + (SOURCE_LDAP, 'LDAP/AD'), + ) id = models.UUIDField(default=uuid.uuid4, primary_key=True) username = models.CharField( max_length=128, unique=True, verbose_name=_('Username') @@ -83,6 +89,10 @@ class User(AbstractUser): created_by = models.CharField( max_length=30, default='', verbose_name=_('Created by') ) + source = models.CharField( + max_length=30, default=SOURCE_LOCAL, choices=SOURCE_CHOICES, + verbose_name=_('Source') + ) def __str__(self): return '{0.name}({0.username})'.format(self) @@ -259,7 +269,7 @@ class User(AbstractUser): return self.otp_level == 2 def enable_otp(self): - if not self.otp_force_enabled: + if not self.otp_level == 2: self.otp_level = 1 def force_enable_otp(self): @@ -279,6 +289,7 @@ class User(AbstractUser): 'is_superuser': self.is_superuser, 'role': self.get_role_display(), 'groups': [group.name for group in self.groups.all()], + 'source': self.get_source_display(), 'wechat': self.wechat, 'phone': self.phone, 'otp_level': self.otp_level, diff --git a/apps/users/serializers.py b/apps/users/serializers.py index f1347b0d5..d3f3eb73f 100644 --- a/apps/users/serializers.py +++ b/apps/users/serializers.py @@ -26,7 +26,10 @@ class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer): def get_field_names(self, declared_fields, info): fields = super(UserSerializer, self).get_field_names(declared_fields, info) - fields.extend(['groups_display', 'get_role_display', 'is_valid']) + fields.extend([ + 'groups_display', 'get_role_display', + 'get_source_display', 'is_valid' + ]) return fields @staticmethod diff --git a/apps/users/signals_handler.py b/apps/users/signals_handler.py index 4c6afc663..bae5e37cd 100644 --- a/apps/users/signals_handler.py +++ b/apps/users/signals_handler.py @@ -2,6 +2,7 @@ # from django.dispatch import receiver +from django_auth_ldap.backend import populate_user # from django.db.models.signals import post_save from common.utils import get_logger @@ -28,3 +29,11 @@ def on_user_create(sender, user=None, **kwargs): logger.info(" - Sending welcome mail ...".format(user.name)) if user.email: send_user_created_mail(user) + + +@receiver(populate_user) +def on_ldap_create_user(sender, user, ldap_user, **kwargs): + if user: + user.source = user.SOURCE_LDAP + user.save() + diff --git a/apps/users/templates/users/user_detail.html b/apps/users/templates/users/user_detail.html index 66bfa61e0..22ab4b5d4 100644 --- a/apps/users/templates/users/user_detail.html +++ b/apps/users/templates/users/user_detail.html @@ -99,6 +99,10 @@ {% endif %} + + {% trans 'Source' %}: + {{ user_object.get_source_display }} + {% trans 'Date expired' %}: {{ user_object.date_expired|date:"Y-m-j H:i:s" }} diff --git a/apps/users/templates/users/user_list.html b/apps/users/templates/users/user_list.html index c7c9b8b28..052c5b7c0 100644 --- a/apps/users/templates/users/user_list.html +++ b/apps/users/templates/users/user_list.html @@ -24,6 +24,7 @@ {% trans 'Username' %} {% trans 'Role' %} {% trans 'User group' %} + {% trans 'Source' %} {% trans 'Active' %} {% trans 'Action' %} @@ -65,14 +66,14 @@ function initTable() { var innerHtml = cellData.length > 20 ? cellData.substring(0, 20) + '...': cellData; $(td).html('' + innerHtml + ''); }}, - {targets: 5, createdCell: function (td, cellData) { + {targets: 6, createdCell: function (td, cellData) { if (!cellData) { $(td).html('') } else { $(td).html('') } }}, - {targets: 6, createdCell: function (td, cellData, rowData) { + {targets: 7, createdCell: function (td, cellData, rowData) { var update_btn = '{% trans "Update" %}'.replace('00000000-0000-0000-0000-000000000000', cellData); var del_btn = ""; @@ -90,7 +91,7 @@ function initTable() { ajax_url: '{% url "api-users:user-list" %}', columns: [ {data: "id"}, {data: "name" }, {data: "username" }, {data: "get_role_display" }, - {data: "groups_display" }, {data: "is_valid" }, {data: "id" } + {data: "groups_display" }, {data: "get_source_display" }, {data: "is_valid" }, {data: "id" } ], op_html: $('#actions').html() }; diff --git a/apps/users/templates/users/user_profile.html b/apps/users/templates/users/user_profile.html index 50dabeabc..0109203df 100644 --- a/apps/users/templates/users/user_profile.html +++ b/apps/users/templates/users/user_profile.html @@ -96,6 +96,10 @@ {% endif %} + + {% trans 'Source' %} + {{ user.get_source_display }} + {% trans 'Date joined' %} {{ user.date_joined|date:"Y-m-d H:i:s" }} diff --git a/apps/users/views/login.py b/apps/users/views/login.py index c058b4402..feaf47e89 100644 --- a/apps/users/views/login.py +++ b/apps/users/views/login.py @@ -83,10 +83,10 @@ class UserLoginView(FormView): user = get_user_or_tmp_user(self.request) if user.otp_enabled and user.otp_secret_key: - # 1,2 & T + # 1,2,mfa_setting & T return reverse('users:login-otp') elif user.otp_enabled and not user.otp_secret_key: - # 1,2 & F + # 1,2,mfa_setting & F return reverse('users:user-otp-enable-authentication') elif not user.otp_enabled: # 0 & T,F