fix: 修复第三方用户忘记密码页面的提示,不允许修改

pull/9079/head
Jiangjie.Bai 2022-11-16 20:34:52 +08:00
parent 18986bc805
commit ad7647c0cc
5 changed files with 67 additions and 47 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:c612630da01a1ec5265966e044f6cf98d557f7db507e9d23c8ba15d409adfbed oid sha256:7db985efdf818137dafe489f339955f4d71a245ffd6becc8f6efac539a625682
size 132739 size 133463

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-16 09:29+0800\n" "POT-Creation-Date: 2022-11-16 20:24+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -474,7 +474,9 @@ msgstr "Chromeパスワード"
msgid "" msgid ""
"Typically, the port is 9000the HTTP interface and the native interface use " "Typically, the port is 9000the HTTP interface and the native interface use "
"different ports" "different ports"
msgstr "デフォルトポートは9000で、HTTPインタフェースとネイティブインタフェースは異なるポートを使用する" msgstr ""
"デフォルトポートは9000で、HTTPインタフェースとネイティブインタフェースは異な"
"るポートを使用する"
#: applications/serializers/attrs/application_type/custom.py:12 #: applications/serializers/attrs/application_type/custom.py:12
msgid "Operating parameter" msgid "Operating parameter"
@ -1689,7 +1691,7 @@ msgstr "現在のユーザーはmfaタイプをサポートしていません: {
msgid "User does not exist: {}" msgid "User does not exist: {}"
msgstr "ユーザーが存在しない: {}" msgstr "ユーザーが存在しない: {}"
#: authentication/api/password.py:31 users/views/profile/reset.py:122 #: authentication/api/password.py:31 users/views/profile/reset.py:127
msgid "No user matched" msgid "No user matched"
msgstr "ユーザーにマッチしなかった" msgstr "ユーザーにマッチしなかった"
@ -2026,7 +2028,7 @@ msgstr "メッセージ検証コードが無効"
#: authentication/serializers/password_mfa.py:24 #: authentication/serializers/password_mfa.py:24
#: settings/serializers/auth/sms.py:27 users/forms/profile.py:103 #: settings/serializers/auth/sms.py:27 users/forms/profile.py:103
#: users/forms/profile.py:106 users/templates/users/forgot_password.html:111 #: users/forms/profile.py:106 users/templates/users/forgot_password.html:111
#: users/views/profile/reset.py:74 #: users/views/profile/reset.py:79
msgid "SMS" msgid "SMS"
msgstr "メッセージ" msgstr "メッセージ"
@ -2165,7 +2167,7 @@ msgstr "アセットまたはアプリが必要"
#: settings/serializers/email.py:50 users/forms/profile.py:102 #: settings/serializers/email.py:50 users/forms/profile.py:102
#: users/forms/profile.py:106 users/models/user.py:675 #: users/forms/profile.py:106 users/models/user.py:675
#: users/templates/users/forgot_password.html:116 #: users/templates/users/forgot_password.html:116
#: users/views/profile/reset.py:68 #: users/views/profile/reset.py:73
msgid "Email" msgid "Email"
msgstr "メール" msgstr "メール"
@ -4729,8 +4731,8 @@ msgstr "期限切れです。"
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
" Your password has expired, please click <a " " Your password has expired, please click <a href="
"href=\"%(user_password_update_url)s\"> this link </a> update password.\n" "\"%(user_password_update_url)s\"> this link </a> update password.\n"
" " " "
msgstr "" msgstr ""
"\n" "\n"
@ -4751,34 +4753,34 @@ msgid ""
" " " "
msgstr "" msgstr ""
"\n" "\n"
" クリックしてください <a " " クリックしてください <a href=\"%(user_password_update_url)s"
"href=\"%(user_password_update_url)s\"> リンク </a> パスワードの更新\n" "\"> リンク </a> パスワードの更新\n"
" " " "
#: templates/_message.html:43 #: templates/_message.html:43
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
" Your information was incomplete. Please click <a " " Your information was incomplete. Please click <a href="
"href=\"%(first_login_url)s\"> this link </a>to complete your information.\n" "\"%(first_login_url)s\"> this link </a>to complete your information.\n"
" " " "
msgstr "" msgstr ""
"\n" "\n"
" あなたの情報が不完全なので、クリックしてください。 <a " " あなたの情報が不完全なので、クリックしてください。 <a href="
"href=\"%(first_login_url)s\"> リンク </a> 補完\n" "\"%(first_login_url)s\"> リンク </a> 補完\n"
" " " "
#: templates/_message.html:56 #: templates/_message.html:56
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
" Your ssh public key not set or expired. Please click <a " " Your ssh public key not set or expired. Please click <a href="
"href=\"%(user_pubkey_update)s\"> this link </a>to update\n" "\"%(user_pubkey_update)s\"> this link </a>to update\n"
" " " "
msgstr "" msgstr ""
"\n" "\n"
" SSHキーが設定されていないか無効になっている場合は、 <a " " SSHキーが設定されていないか無効になっている場合は、 <a href="
"href=\"%(user_pubkey_update)s\"> リンク </a> 更新\n" "\"%(user_pubkey_update)s\"> リンク </a> 更新\n"
" " " "
#: templates/_mfa_login_field.html:28 #: templates/_mfa_login_field.html:28
@ -5907,7 +5909,7 @@ msgstr "ユーザーパスワード履歴"
msgid "Reset password" msgid "Reset password"
msgstr "パスワードのリセット" msgstr "パスワードのリセット"
#: users/notifications.py:85 users/views/profile/reset.py:189 #: users/notifications.py:85 users/views/profile/reset.py:194
msgid "Reset password success" msgid "Reset password success"
msgstr "パスワードのリセット成功" msgstr "パスワードのリセット成功"
@ -6271,23 +6273,30 @@ msgstr "OTP無効化成功、ログインページを返す"
msgid "Password invalid" msgid "Password invalid"
msgstr "パスワード無効" msgstr "パスワード無効"
#: users/views/profile/reset.py:144 users/views/profile/reset.py:155 #: users/views/profile/reset.py:47
msgid ""
"Non-local users can log in only from third-party platforms and cannot change "
"their passwords: {}"
msgstr "ローカル以外のユーザーは、サードパーティ プラットフォームからのログインのみが許可され、"
"パスワードの変更はサポートされていません: {}"
#: users/views/profile/reset.py:149 users/views/profile/reset.py:160
msgid "Token invalid or expired" msgid "Token invalid or expired"
msgstr "トークンが無効または期限切れ" msgstr "トークンが無効または期限切れ"
#: users/views/profile/reset.py:160 #: users/views/profile/reset.py:165
msgid "User auth from {}, go there change password" msgid "User auth from {}, go there change password"
msgstr "ユーザー認証ソース {}, 対応するシステムにパスワードを変更してください" msgstr "ユーザー認証ソース {}, 対応するシステムにパスワードを変更してください"
#: users/views/profile/reset.py:167 #: users/views/profile/reset.py:172
msgid "* Your password does not meet the requirements" msgid "* Your password does not meet the requirements"
msgstr "* パスワードが要件を満たしていない" msgstr "* パスワードが要件を満たしていない"
#: users/views/profile/reset.py:173 #: users/views/profile/reset.py:178
msgid "* The new password cannot be the last {} passwords" msgid "* The new password cannot be the last {} passwords"
msgstr "* 新しいパスワードを最後の {} パスワードにすることはできません" msgstr "* 新しいパスワードを最後の {} パスワードにすることはできません"
#: users/views/profile/reset.py:190 #: users/views/profile/reset.py:195
msgid "Reset password success, return to login page" msgid "Reset password success, return to login page"
msgstr "パスワードの成功をリセットし、ログインページに戻る" msgstr "パスワードの成功をリセットし、ログインページに戻る"

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:a77697e0f3332c8679c554fdbd1579b2337cc641a7e42cca2c039360c9056d95 oid sha256:b143c62843946c3e18b623d05065f12e9d3c578efe5cd0d2016056d2b8448ae8
size 108944 size 109495

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: JumpServer 0.3.3\n" "Project-Id-Version: JumpServer 0.3.3\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-16 09:32+0800\n" "POT-Creation-Date: 2022-11-16 20:24+0800\n"
"PO-Revision-Date: 2021-05-20 10:54+0800\n" "PO-Revision-Date: 2021-05-20 10:54+0800\n"
"Last-Translator: ibuler <ibuler@qq.com>\n" "Last-Translator: ibuler <ibuler@qq.com>\n"
"Language-Team: JumpServer team<ibuler@qq.com>\n" "Language-Team: JumpServer team<ibuler@qq.com>\n"
@ -1677,7 +1677,7 @@ msgstr "当前用户不支持 MFA 类型: {}"
msgid "User does not exist: {}" msgid "User does not exist: {}"
msgstr "用户不存在: {}" msgstr "用户不存在: {}"
#: authentication/api/password.py:31 users/views/profile/reset.py:122 #: authentication/api/password.py:31 users/views/profile/reset.py:127
msgid "No user matched" msgid "No user matched"
msgstr "没有匹配到用户" msgstr "没有匹配到用户"
@ -2002,7 +2002,7 @@ msgstr "短信验证码校验失败"
#: authentication/serializers/password_mfa.py:24 #: authentication/serializers/password_mfa.py:24
#: settings/serializers/auth/sms.py:27 users/forms/profile.py:103 #: settings/serializers/auth/sms.py:27 users/forms/profile.py:103
#: users/forms/profile.py:106 users/templates/users/forgot_password.html:111 #: users/forms/profile.py:106 users/templates/users/forgot_password.html:111
#: users/views/profile/reset.py:74 #: users/views/profile/reset.py:79
msgid "SMS" msgid "SMS"
msgstr "短信" msgstr "短信"
@ -2137,7 +2137,7 @@ msgstr "资产或应用必填"
#: settings/serializers/email.py:50 users/forms/profile.py:102 #: settings/serializers/email.py:50 users/forms/profile.py:102
#: users/forms/profile.py:106 users/models/user.py:675 #: users/forms/profile.py:106 users/models/user.py:675
#: users/templates/users/forgot_password.html:116 #: users/templates/users/forgot_password.html:116
#: users/views/profile/reset.py:68 #: users/views/profile/reset.py:73
msgid "Email" msgid "Email"
msgstr "邮箱" msgstr "邮箱"
@ -4652,13 +4652,13 @@ msgstr "过期。"
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
" Your password has expired, please click <a " " Your password has expired, please click <a href="
"href=\"%(user_password_update_url)s\"> this link </a> update password.\n" "\"%(user_password_update_url)s\"> this link </a> update password.\n"
" " " "
msgstr "" msgstr ""
"\n" "\n"
" 您的密码已经过期,请点击 <a " " 您的密码已经过期,请点击 <a href="
"href=\"%(user_password_update_url)s\"> 链接 </a> 更新密码\n" "\"%(user_password_update_url)s\"> 链接 </a> 更新密码\n"
" " " "
#: templates/_message.html:30 #: templates/_message.html:30
@ -4682,8 +4682,8 @@ msgstr ""
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
" Your information was incomplete. Please click <a " " Your information was incomplete. Please click <a href="
"href=\"%(first_login_url)s\"> this link </a>to complete your information.\n" "\"%(first_login_url)s\"> this link </a>to complete your information.\n"
" " " "
msgstr "" msgstr ""
"\n" "\n"
@ -4695,13 +4695,13 @@ msgstr ""
#, python-format #, python-format
msgid "" msgid ""
"\n" "\n"
" Your ssh public key not set or expired. Please click <a " " Your ssh public key not set or expired. Please click <a href="
"href=\"%(user_pubkey_update)s\"> this link </a>to update\n" "\"%(user_pubkey_update)s\"> this link </a>to update\n"
" " " "
msgstr "" msgstr ""
"\n" "\n"
" 您的SSH密钥没有设置或已失效请点击 <a " " 您的SSH密钥没有设置或已失效请点击 <a href="
"href=\"%(user_pubkey_update)s\"> 链接 </a> 更新\n" "\"%(user_pubkey_update)s\"> 链接 </a> 更新\n"
" " " "
#: templates/_mfa_login_field.html:28 #: templates/_mfa_login_field.html:28
@ -5814,7 +5814,7 @@ msgstr "用户密码历史"
msgid "Reset password" msgid "Reset password"
msgstr "重置密码" msgstr "重置密码"
#: users/notifications.py:85 users/views/profile/reset.py:189 #: users/notifications.py:85 users/views/profile/reset.py:194
msgid "Reset password success" msgid "Reset password success"
msgstr "重置密码成功" msgstr "重置密码成功"
@ -6168,23 +6168,29 @@ msgstr "MFA(OTP) 禁用成功,返回登录页面"
msgid "Password invalid" msgid "Password invalid"
msgstr "用户名或密码无效" msgstr "用户名或密码无效"
#: users/views/profile/reset.py:144 users/views/profile/reset.py:155 #: users/views/profile/reset.py:47
msgid ""
"Non-local users can log in only from third-party platforms and cannot change "
"their passwords: {}"
msgstr "非本地用户仅允许从第三方平台登录,不支持修改密码: {}"
#: users/views/profile/reset.py:149 users/views/profile/reset.py:160
msgid "Token invalid or expired" msgid "Token invalid or expired"
msgstr "Token错误或失效" msgstr "Token错误或失效"
#: users/views/profile/reset.py:160 #: users/views/profile/reset.py:165
msgid "User auth from {}, go there change password" msgid "User auth from {}, go there change password"
msgstr "用户认证源来自 {}, 请去相应系统修改密码" msgstr "用户认证源来自 {}, 请去相应系统修改密码"
#: users/views/profile/reset.py:167 #: users/views/profile/reset.py:172
msgid "* Your password does not meet the requirements" msgid "* Your password does not meet the requirements"
msgstr "* 您的密码不符合要求" msgstr "* 您的密码不符合要求"
#: users/views/profile/reset.py:173 #: users/views/profile/reset.py:178
msgid "* The new password cannot be the last {} passwords" msgid "* The new password cannot be the last {} passwords"
msgstr "* 新密码不能是最近 {} 次的密码" msgstr "* 新密码不能是最近 {} 次的密码"
#: users/views/profile/reset.py:190 #: users/views/profile/reset.py:195
msgid "Reset password success, return to login page" msgid "Reset password success, return to login page"
msgstr "重置密码成功,返回到登录页面" msgstr "重置密码成功,返回到登录页面"

View File

@ -43,6 +43,11 @@ class UserForgotPasswordPreviewingView(FormView):
if not user: if not user:
form.add_error('username', _('User does not exist: {}').format(username)) form.add_error('username', _('User does not exist: {}').format(username))
return super().form_invalid(form) return super().form_invalid(form)
if settings.ONLY_ALLOW_AUTH_FROM_SOURCE and not user.is_local:
error = _('Non-local users can log in only from third-party platforms '
'and cannot change their passwords: {}').format(username)
form.add_error('username', error)
return super().form_invalid(form)
token = random_string(36) token = random_string(36)
user_map = {'username': user.username, 'phone': user.phone, 'email': user.email} user_map = {'username': user.username, 'phone': user.phone, 'email': user.email}