From 759760e7d9075bc1d5bb0a7d726c76a9b07e491c Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 21 Mar 2018 15:22:10 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E7=94=9F=E6=88=90=E7=94=A8=E6=88=B7=E5=AF=86=E9=92=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/i18n/zh/LC_MESSAGES/django.mo | Bin 29683 -> 29778 bytes apps/i18n/zh/LC_MESSAGES/django.po | 200 ++++++++++-------- apps/users/forms.py | 34 ++- apps/users/models/user.py | 2 +- apps/users/templates/users/first_login.html | 8 +- apps/users/templates/users/user_profile.html | 25 ++- .../templates/users/user_pubkey_update.html | 6 + apps/users/templates/users/user_update.html | 1 + apps/users/urls/views_urls.py | 1 + apps/users/views/user.py | 15 +- 10 files changed, 188 insertions(+), 104 deletions(-) diff --git a/apps/i18n/zh/LC_MESSAGES/django.mo b/apps/i18n/zh/LC_MESSAGES/django.mo index 161c337a8ecd1c8cec04b2a990b68511f9a31af9..61378222c5d09ce31638c9e2c087ea860f64fdf3 100644 GIT binary patch delta 10721 zcmZA73w+P@9>?+D%ot`G&0L0=FsxzAU6{K!x2{>k&3V25zmL-%=l3|DJ-?st{rCO-{{P|hb3wqT*8|*(<%=(M zxV{c>oJee4&T-}ybDTldRqHsDV;pAzX5kDhUe9q((RU8Mf&&_mQ-3?wal-NF{f<)u zFXMw45a&1yb=sQ4u>|=NWIfkeL7^lS+pHna+>h+VIf{XJ9!ud@7>$Lf4Tm&zoM5bn zWia0IHmH7GQ2n09;y4er-Xgq*^_^S__fqi|md4%Y0SqHQf#vWDmc^ftn|GW>juQm+ zkt(MVY6F9@0**rUpMhF98`VDtLvSUAvcB^+g^IWhHNnSfz%Ni83s4jN+uDmY_BIxZ z+He%Ae*@GBwM32Ui1*;5s7Esdb@Y=l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%KDukFQn(ci;DJEX?>i9^fqsz*wQM?kWaUc!>n$rxsv+9)~2dA ztbCU8Nh?2x?~u18DiU)EKk7OVr3hU+OqKPoj7|$;n=-ETL=z&0Xh!JLZ^Wrj-Si{n z52=eKmJ)Y~$wVme8=-465lO$DzU==$KDFWxxKqzRoI(s8bKyTQ8ZQuS2wl%o_cO8G zOPyAfhY?-K^AiD-YY@8P@KfSV%M0LgD>uc9#1F)5`qn41^!?wKinj<|C5hUUpC{H* ze#Pq5_PUk#Q0_>)N=%@xG?AYuOthn}4AGESK|Tt5VO11i$q6hU6_zz+O@tAn}`jGZ)D)!@(>mG%#EE$g>R{qIcY<;(2CF+Kvn?s=oF^^bp z9g5*g#4Mr?@ds_kP}c+x-_H(Ke#Y9Gl3$>F5xWx~6Hl&Y)E~5dBdHupysYQ{hvrEhn>sEcbzI`;?0oen`8AGD z8IxRIRA|WX;VR+(@=!n!wG>?o(OHCXbF(G-xh={?75eZ`x0UB=%4XNqw5)u8_y0(9PbV5Hu)}B_Q<%$!5P!qrDprL|1%)CcHM~Du?=h0 z&kpKxEHqEfrcGCNPP?}GgY47&Q~X-om^S~~f(=)8&$&K#3%y$f@) z_vGwZo3k|Y+PocCx6Qe-cjeW2tFG?ZeRXx__4FAzGj?77c-EEO>#yug&zL%}QTD`v o>-{qtCG5!v8!{_+XS&U>bjX2R*`tQu49XauGAR3pl*s}A1\n" "Language-Team: Jumpserver team\n" @@ -29,9 +29,8 @@ msgstr "" msgid "测试节点下资产是否可连接: {}" msgstr "" -#: assets/forms/asset.py:23 assets/forms/asset.py:54 assets/forms/user.py:125 -#: assets/models/asset.py:53 assets/models/user.py:218 -#: assets/templates/assets/asset_detail.html:183 +#: assets/forms/asset.py:23 assets/forms/asset.py:54 assets/models/asset.py:53 +#: assets/models/user.py:218 assets/templates/assets/asset_detail.html:183 #: assets/templates/assets/asset_detail.html:191 #: assets/templates/assets/system_user_detail.html:166 msgid "Nodes" @@ -64,7 +63,7 @@ msgid "* required Must set exact system platform, Windows, Linux ..." msgstr "* required 必须准确设置操作系统平台,如Windows, Linux ..." #: assets/forms/asset.py:80 assets/forms/asset.py:84 assets/forms/label.py:15 -#: perms/templates/perms/asset_permission_asset.html:88 users/forms.py:244 +#: perms/templates/perms/asset_permission_asset.html:88 users/forms.py:270 msgid "Select assets" msgstr "选择资产" @@ -162,15 +161,11 @@ msgstr "名称" msgid "Username" msgstr "用户名" -#: assets/forms/user.py:132 -msgid "If auto push checked, system user will be create at node assets" -msgstr "如果选择了自动推送,系统用户将会创建在节点资产上" - -#: assets/forms/user.py:133 +#: assets/forms/user.py:126 msgid "Auto push system user to asset" msgstr "自动推送系统用户到资产" -#: assets/forms/user.py:134 +#: assets/forms/user.py:127 msgid "" "High level will be using login asset as default, if user was granted more " "than 2 system user" @@ -370,10 +365,10 @@ msgstr "默认资产组" #: terminal/templates/terminal/command_list.html:32 #: terminal/templates/terminal/command_list.html:72 #: terminal/templates/terminal/session_list.html:33 -#: terminal/templates/terminal/session_list.html:71 users/forms.py:192 +#: terminal/templates/terminal/session_list.html:71 users/forms.py:218 #: users/models/user.py:30 users/models/user.py:254 #: users/templates/users/user_group_detail.html:78 -#: users/templates/users/user_group_list.html:13 users/views/user.py:333 +#: users/templates/users/user_group_list.html:13 users/views/user.py:334 msgid "User" msgstr "用户" @@ -627,7 +622,7 @@ msgstr "激活所选" #: users/templates/users/user_list.html:44 #: users/templates/users/user_password_update.html:59 #: users/templates/users/user_profile_update.html:64 -#: users/templates/users/user_pubkey_update.html:71 +#: users/templates/users/user_pubkey_update.html:77 msgid "Submit" msgstr "提交" @@ -647,6 +642,8 @@ msgstr "提交" #: 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:135 +#: users/templates/users/user_profile.html:143 msgid "Update" msgstr "更新" @@ -713,10 +710,10 @@ msgstr "其它" #: users/templates/users/_user.html:43 #: users/templates/users/user_bulk_update.html:23 #: users/templates/users/user_password_update.html:58 -#: users/templates/users/user_profile.html:135 -#: users/templates/users/user_profile.html:143 +#: users/templates/users/user_profile.html:151 #: users/templates/users/user_profile_update.html:63 #: users/templates/users/user_pubkey_update.html:70 +#: users/templates/users/user_pubkey_update.html:76 msgid "Reset" msgstr "重置" @@ -782,7 +779,7 @@ msgstr "替换资产的管理员" #: users/templates/users/user_group_create_update.html:32 #: users/templates/users/user_group_list.html:86 #: users/templates/users/user_list.html:196 -#: users/templates/users/user_profile.html:177 +#: users/templates/users/user_profile.html:185 msgid "Confirm" msgstr "确认" @@ -1175,6 +1172,7 @@ msgid "User search filter" msgstr "用户过滤器" #: common/forms.py:121 +#, python-format msgid "Choice may be (cn|uid|sAMAccountName)=%(user)s)" msgstr "可能的选项是(cn或uid或sAMAccountName=%(user)s)" @@ -1613,7 +1611,7 @@ msgstr "添加" msgid "Add asset group to this permission" msgstr "添加资产组" -#: perms/templates/perms/asset_permission_asset.html:116 users/forms.py:247 +#: perms/templates/perms/asset_permission_asset.html:116 users/forms.py:273 msgid "Select asset groups" msgstr "选择资产组" @@ -1642,7 +1640,7 @@ msgstr "资产组数量" msgid "System user count" msgstr "系统用户数量" -#: perms/templates/perms/asset_permission_detail.html:144 users/forms.py:250 +#: perms/templates/perms/asset_permission_detail.html:144 users/forms.py:276 msgid "Select system users" msgstr "选择系统用户" @@ -1695,13 +1693,13 @@ msgstr "商业支持" msgid "Docs" msgstr "文档" -#: templates/_header_bar.html:37 templates/_nav_user.html:9 +#: templates/_header_bar.html:37 templates/_nav_user.html:9 users/forms.py:92 #: users/templates/users/_user.html:36 #: users/templates/users/user_password_update.html:37 #: 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:316 +#: users/templates/users/user_pubkey_update.html:37 users/views/user.py:317 msgid "Profile" msgstr "个人信息" @@ -1758,13 +1756,13 @@ 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:209 users/views/login.py:258 users/views/user.py:59 -#: users/views/user.py:74 users/views/user.py:93 users/views/user.py:149 -#: users/views/user.py:304 users/views/user.py:351 users/views/user.py:373 +#: users/views/login.py:209 users/views/login.py:258 users/views/user.py:60 +#: users/views/user.py:75 users/views/user.py:94 users/views/user.py:150 +#: users/views/user.py:305 users/views/user.py:352 users/views/user.py:374 msgid "Users" msgstr "用户管理" -#: templates/_nav.html:13 users/views/user.py:60 +#: templates/_nav.html:13 users/views/user.py:61 msgid "User list" msgstr "用户列表" @@ -2087,51 +2085,63 @@ msgstr "" msgid "Role" msgstr "角色" -#: users/forms.py:45 users/templates/users/user_detail.html:187 -msgid "Join user groups" -msgstr "添加到用户组" - -#: users/forms.py:76 -msgid "Old password" -msgstr "原来密码" - -#: users/forms.py:81 -msgid "New password" -msgstr "新密码" - -#: users/forms.py:86 -msgid "Confirm password" -msgstr "确认密码" - -#: users/forms.py:96 -msgid "Old password error" -msgstr "原来密码错误" - -#: users/forms.py:104 -msgid "Password does not match" -msgstr "密码不一致" - -#: users/forms.py:116 +#: users/forms.py:30 users/forms.py:138 msgid "ssh public key" msgstr "ssh公钥" -#: users/forms.py:117 +#: users/forms.py:31 users/forms.py:139 msgid "ssh-rsa AAAA..." msgstr "" -#: users/forms.py:118 -msgid "Paste your id_rsa.pub here." -msgstr "复制你的公钥到这里" +#: users/forms.py:32 +msgid "Paste user id_rsa.pub here." +msgstr "复制用户公钥到这里" -#: users/forms.py:131 +#: users/forms.py:50 users/templates/users/user_detail.html:187 +msgid "Join user groups" +msgstr "添加到用户组" + +#: users/forms.py:58 users/forms.py:153 msgid "Public key should not be the same as your old one." msgstr "不能和原来的密钥相同" -#: users/forms.py:135 users/serializers.py:42 +#: users/forms.py:62 users/forms.py:157 users/serializers.py:42 msgid "Not a valid ssh public key" msgstr "ssh密钥不合法" -#: users/forms.py:149 users/forms.py:154 users/forms.py:166 users/forms.py:196 +#: users/forms.py:98 +msgid "Old password" +msgstr "原来密码" + +#: users/forms.py:103 +msgid "New password" +msgstr "新密码" + +#: users/forms.py:108 +msgid "Confirm password" +msgstr "确认密码" + +#: users/forms.py:118 +msgid "Old password error" +msgstr "原来密码错误" + +#: users/forms.py:126 +msgid "Password does not match" +msgstr "密码不一致" + +#: users/forms.py:140 +msgid "Paste your id_rsa.pub here." +msgstr "复制你的公钥到这里" + +#: users/forms.py:168 users/models/user.py:46 +#: users/templates/users/user_password_update.html:43 +#: users/templates/users/user_profile.html:71 +#: users/templates/users/user_profile_update.html:43 +#: users/templates/users/user_pubkey_update.html:43 +msgid "Public key" +msgstr "ssh公钥" + +#: users/forms.py:175 users/forms.py:180 users/forms.py:192 users/forms.py:222 msgid "Select users" msgstr "选择用户" @@ -2184,13 +2194,6 @@ msgstr "微信" msgid "Enable OTP" msgstr "二次验证" -#: users/models/user.py:46 users/templates/users/user_password_update.html:43 -#: users/templates/users/user_profile.html:71 -#: users/templates/users/user_profile_update.html:43 -#: users/templates/users/user_pubkey_update.html:43 -msgid "Public key" -msgstr "ssh公钥" - #: users/models/user.py:265 msgid "Administrator is the super user of system" msgstr "Administrator是初始的超级管理员" @@ -2241,13 +2244,13 @@ msgstr "首次登陆" msgid "Step" msgstr "Step" -#: users/templates/users/first_login.html:59 -msgid "First step" -msgstr "第一步" +#: users/templates/users/first_login.html:57 +msgid "Previous" +msgstr "" #: users/templates/users/first_login.html:60 -msgid "Prev step" -msgstr "上一步" +msgid "Next" +msgstr "" #: users/templates/users/first_login_done.html:30 msgid "Welcome to use jumpserver, visit " @@ -2283,8 +2286,7 @@ msgid "City" msgstr "城市" #: users/templates/users/reset_password.html:45 -#: users/templates/users/user_detail.html:325 -#: users/templates/users/user_profile.html:132 users/utils.py:71 +#: users/templates/users/user_detail.html:325 users/utils.py:71 msgid "Reset password" msgstr "重置密码" @@ -2298,7 +2300,7 @@ msgid "Setting" msgstr "设置" #: users/templates/users/user_create.html:4 -#: users/templates/users/user_list.html:16 users/views/user.py:74 +#: users/templates/users/user_list.html:16 users/views/user.py:75 msgid "Create user" msgstr "创建用户" @@ -2307,7 +2309,7 @@ msgid "Reset link will be generated and sent to the user. " msgstr "生成重置密码连接,通过邮件发送给用户" #: users/templates/users/user_detail.html:19 -#: users/templates/users/user_granted_asset.html:18 users/views/user.py:150 +#: users/templates/users/user_granted_asset.html:18 users/views/user.py:151 msgid "User detail" msgstr "用户详情" @@ -2351,7 +2353,6 @@ msgid "" msgstr "重设密钥邮件将会发送到用户邮箱" #: users/templates/users/user_detail.html:350 -#: users/templates/users/user_profile.html:140 msgid "Reset SSH public key" msgstr "重置SSH密钥" @@ -2360,14 +2361,14 @@ msgid "This will reset the user public key and send a reset mail" msgstr "将会失效用户当前密钥,并发送重置邮件到用户邮箱" #: users/templates/users/user_detail.html:377 -#: users/templates/users/user_profile.html:166 +#: users/templates/users/user_profile.html:174 msgid "Successfully updated the SSH public key." msgstr "更新ssh密钥成功" #: users/templates/users/user_detail.html:378 #: users/templates/users/user_detail.html:382 -#: users/templates/users/user_profile.html:167 -#: users/templates/users/user_profile.html:172 +#: users/templates/users/user_profile.html:175 +#: users/templates/users/user_profile.html:180 msgid "User SSH public key update" msgstr "ssh密钥" @@ -2427,12 +2428,24 @@ msgstr "用户删除失败" msgid "OTP" msgstr "" -#: users/templates/users/user_profile.html:100 users/views/user.py:179 -#: users/views/user.py:233 +#: users/templates/users/user_profile.html:100 users/views/user.py:180 +#: users/views/user.py:234 msgid "User groups" msgstr "用户组" -#: users/templates/users/user_profile.html:170 +#: users/templates/users/user_profile.html:132 +msgid "Update password" +msgstr "更改密码" + +#: users/templates/users/user_profile.html:140 +msgid "Update SSH public key" +msgstr "更改SSH密钥" + +#: users/templates/users/user_profile.html:148 +msgid "Reset public key and download" +msgstr "重置并下载SSH密钥" + +#: users/templates/users/user_profile.html:178 msgid "Failed to update SSH public key." msgstr "更新密钥失败" @@ -2448,7 +2461,11 @@ msgstr "指纹" msgid "Update public key" msgstr "更新密钥" -#: users/templates/users/user_update.html:4 users/views/user.py:93 +#: users/templates/users/user_pubkey_update.html:68 +msgid "Or reset by server" +msgstr "或者重置并下载密钥" + +#: users/templates/users/user_update.html:4 users/views/user.py:94 msgid "Update user" msgstr "更新用户" @@ -2643,30 +2660,39 @@ msgstr "首次登陆" msgid "Login log list" msgstr "登录日志" -#: users/views/user.py:103 +#: users/views/user.py:104 msgid "Bulk update user success" msgstr "批量更新用户成功" -#: users/views/user.py:208 +#: users/views/user.py:209 msgid "Invalid file." msgstr "文件不合法" -#: users/views/user.py:305 +#: users/views/user.py:306 msgid "User granted assets" msgstr "用户授权资产" -#: users/views/user.py:334 +#: users/views/user.py:335 msgid "Profile setting" msgstr "个人信息设置" -#: users/views/user.py:352 +#: users/views/user.py:353 msgid "Password update" msgstr "密码更新" -#: users/views/user.py:374 +#: users/views/user.py:375 msgid "Public key update" msgstr "密钥更新" +#~ msgid "If auto push checked, system user will be create at node assets" +#~ msgstr "如果选择了自动推送,系统用户将会创建在节点资产上" + +#~ msgid "First step" +#~ msgstr "第一步" + +#~ msgid "Prev step" +#~ msgstr "上一步" + #~ msgid "Test node assets connective: {}" #~ msgstr "测试节点资产可连接性" diff --git a/apps/users/forms.py b/apps/users/forms.py index 58b78de71..8d223b627 100644 --- a/apps/users/forms.py +++ b/apps/users/forms.py @@ -26,6 +26,11 @@ class UserCreateUpdateForm(forms.ModelForm): max_length=128, strip=False, required=False, ) role = forms.ChoiceField(choices=role_choices, required=True, initial=User.ROLE_USER, label=_("Role")) + public_key = forms.CharField( + label=_('ssh public key'), max_length=5000, + widget=forms.Textarea(attrs={'placeholder': _('ssh-rsa AAAA...')}), + help_text=_('Paste user id_rsa.pub here.') + ) class Meta: model = User @@ -47,12 +52,26 @@ class UserCreateUpdateForm(forms.ModelForm): ), } + def clean_public_key(self): + public_key = self.cleaned_data['public_key'] + if self.instance.public_key and public_key == self.instance.public_key: + msg = _('Public key should not be the same as your old one.') + raise forms.ValidationError(msg) + + if not validate_ssh_public_key(public_key): + raise forms.ValidationError(_('Not a valid ssh public key')) + return public_key + def save(self, commit=True): password = self.cleaned_data.get('password') + public_key = self.cleaned_data.get('public_key') user = super().save(commit=commit) if password: user.set_password(password) user.save() + if public_key: + user.public_key = public_key + user.save() return user @@ -70,6 +89,9 @@ class UserProfileForm(forms.ModelForm): } +UserProfileForm.verbose_name = _("Profile") + + class UserPasswordForm(forms.Form): old_password = forms.CharField( max_length=128, widget=forms.PasswordInput, @@ -113,7 +135,7 @@ class UserPasswordForm(forms.Form): class UserPublicKeyForm(forms.Form): public_key = forms.CharField( - label=_('ssh public key'), max_length=5000, + label=_('ssh public key'), max_length=5000, required=False, widget=forms.Textarea(attrs={'placeholder': _('ssh-rsa AAAA...')}), help_text=_('Paste your id_rsa.pub here.') ) @@ -131,17 +153,21 @@ class UserPublicKeyForm(forms.Form): msg = _('Public key should not be the same as your old one.') raise forms.ValidationError(msg) - if not validate_ssh_public_key(public_key): + if public_key and not validate_ssh_public_key(public_key): raise forms.ValidationError(_('Not a valid ssh public key')) return public_key def save(self): public_key = self.cleaned_data['public_key'] - self.instance.public_key = public_key - self.instance.save() + if public_key: + self.instance.public_key = public_key + self.instance.save() return self.instance +UserPublicKeyForm.verbose_name = _("Public key") + + class UserBulkUpdateForm(forms.ModelForm): users = forms.ModelMultipleChoiceField( required=True, diff --git a/apps/users/models/user.py b/apps/users/models/user.py index 4c051db22..0e2e06f39 100644 --- a/apps/users/models/user.py +++ b/apps/users/models/user.py @@ -115,7 +115,7 @@ class User(AbstractUser): import sshpubkeys try: return sshpubkeys.SSHKey(self.public_key) - except TabError: + except (TabError, TypeError): pass return PubKey() diff --git a/apps/users/templates/users/first_login.html b/apps/users/templates/users/first_login.html index 99aff6ccf..b670caf60 100644 --- a/apps/users/templates/users/first_login.html +++ b/apps/users/templates/users/first_login.html @@ -45,10 +45,8 @@ {{ wizard.form.management_form }} {% for form in wizard.form.forms %} {% bootstrap_form form %} -{# {{ form|bootstrap }}#} {% endfor %} {% else %} -{# {{ wizard.form|bootstrap }}#} {% bootstrap_form wizard.form %} {% endif %} @@ -56,8 +54,10 @@
diff --git a/apps/users/templates/users/user_profile.html b/apps/users/templates/users/user_profile.html index e7e8640f9..88d963595 100644 --- a/apps/users/templates/users/user_profile.html +++ b/apps/users/templates/users/user_profile.html @@ -22,7 +22,7 @@
-
+
{{ user.name }} @@ -120,7 +120,7 @@
-
+
{% trans 'Quick modify' %} @@ -129,18 +129,26 @@ - + - + + + + + @@ -180,8 +188,11 @@ $(document).on('click', '#btn_update_pk', function() { $('#txt_pk').focus(); } ); - } + }; APIUpdateAttr({ url: the_url, body: JSON.stringify(body), success: success, error: fail}); +}).on('click', '.btn-reset-pubkey', function () { + var the_url = '{% url "users:user-pubkey-generate" %}'; + window.open(the_url, "_blank") }) {% endblock %} diff --git a/apps/users/templates/users/user_pubkey_update.html b/apps/users/templates/users/user_pubkey_update.html index ee621eb8d..82c4a3590 100644 --- a/apps/users/templates/users/user_pubkey_update.html +++ b/apps/users/templates/users/user_pubkey_update.html @@ -64,6 +64,12 @@

{% trans 'Update public key' %}

{% bootstrap_field form.public_key layout="horizontal" %} +
+ + +
diff --git a/apps/users/templates/users/user_update.html b/apps/users/templates/users/user_update.html index a83d89859..88ec01c5c 100644 --- a/apps/users/templates/users/user_update.html +++ b/apps/users/templates/users/user_update.html @@ -5,4 +5,5 @@ {% block password %}

{% trans 'Auth' %}

{% bootstrap_field form.password layout="horizontal" %} + {% bootstrap_field form.public_key layout="horizontal" %} {% endblock %} diff --git a/apps/users/urls/views_urls.py b/apps/users/urls/views_urls.py index 5d23976ae..b9d6788ee 100644 --- a/apps/users/urls/views_urls.py +++ b/apps/users/urls/views_urls.py @@ -20,6 +20,7 @@ urlpatterns = [ url(r'^profile/update/$', views.UserProfileUpdateView.as_view(), name='user-profile-update'), url(r'^profile/password/update/$', views.UserPasswordUpdateView.as_view(), name='user-password-update'), url(r'^profile/pubkey/update/$', views.UserPublicKeyUpdateView.as_view(), name='user-pubkey-update'), + url(r'^profile/pubkey/generate/$', views.UserPublicKeyGenerateView.as_view(), name='user-pubkey-generate'), # User view url(r'^user$', views.UserListView.as_view(), name='user-list'), diff --git a/apps/users/views/user.py b/apps/users/views/user.py index bf2ecca57..84c670370 100644 --- a/apps/users/views/user.py +++ b/apps/users/views/user.py @@ -31,7 +31,7 @@ from django.contrib.auth import logout as auth_logout from common.const import create_success_msg, update_success_msg from common.mixins import JSONResponseMixin -from common.utils import get_logger, get_object_or_none, is_uuid +from common.utils import get_logger, get_object_or_none, is_uuid, ssh_key_gen from .. import forms from ..models import User, UserGroup from ..utils import AdminUserRequiredMixin @@ -45,6 +45,7 @@ __all__ = [ 'UserExportView', 'UserBulkImportView', 'UserProfileView', 'UserProfileUpdateView', 'UserPasswordUpdateView', 'UserPublicKeyUpdateView', 'UserBulkUpdateView', + 'UserPublicKeyGenerateView', ] logger = get_logger(__name__) @@ -375,3 +376,15 @@ class UserPublicKeyUpdateView(LoginRequiredMixin, UpdateView): } kwargs.update(context) return super().get_context_data(**kwargs) + + +class UserPublicKeyGenerateView(LoginRequiredMixin, View): + def get(self, request, *args, **kwargs): + private, public = ssh_key_gen(username=request.user.username, hostname='jumpserver') + request.user.public_key = public + request.user.save() + response = HttpResponse(private, content_type='text/plain') + filename = "{0}-jumpserver.pem".format(request.user.username) + response['Content-Disposition'] = 'attachment; filename={}'.format(filename) + return response +
{% trans 'Reset password' %}:{% trans 'Update password' %}: - {% trans 'Reset' %} + {% trans 'Update' %}
{% trans 'Reset SSH public key' %}:{% trans 'Update SSH public key' %}: - {% trans 'Reset' %} + {% trans 'Update' %} + +
{% trans 'Reset public key and download' %}: + + {% trans 'Reset' %}