mirror of https://github.com/jumpserver/jumpserver
feat: 增加绑定成功失败提示
parent
b6a5854fa2
commit
5b4de02fff
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-19 15:05+0800\n"
|
||||
"POT-Creation-Date: 2024-11-19 16:36+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"
|
||||
|
@ -9484,6 +9484,22 @@ msgstr ""
|
|||
msgid "Redirecting to JumpServer Client"
|
||||
msgstr ""
|
||||
|
||||
#: users/views/profile/face.py:54
|
||||
msgid "Face recognition enable success"
|
||||
msgstr ""
|
||||
|
||||
#: users/views/profile/face.py:55
|
||||
msgid "Face recognition enable success, return login page"
|
||||
msgstr ""
|
||||
|
||||
#: users/views/profile/face.py:78
|
||||
msgid "Face recognition disable success"
|
||||
msgstr ""
|
||||
|
||||
#: users/views/profile/face.py:79
|
||||
msgid "Face recognition disable success, return login page"
|
||||
msgstr ""
|
||||
|
||||
#: users/views/profile/otp.py:106
|
||||
msgid "Already bound"
|
||||
msgstr ""
|
||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-19 15:05+0800\n"
|
||||
"POT-Creation-Date: 2024-11-19 16:36+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"
|
||||
|
@ -9984,6 +9984,30 @@ msgstr "認証データベース"
|
|||
msgid "Redirecting to JumpServer Client"
|
||||
msgstr ""
|
||||
|
||||
#: users/views/profile/face.py:54
|
||||
#, fuzzy
|
||||
#| msgid "Basic edition"
|
||||
msgid "Face recognition enable success"
|
||||
msgstr "エンタープライズ基本版"
|
||||
|
||||
#: users/views/profile/face.py:55
|
||||
#, fuzzy
|
||||
#| msgid "OTP enable success, return login page"
|
||||
msgid "Face recognition enable success, return login page"
|
||||
msgstr "OTP有効化成功、ログインページを返す"
|
||||
|
||||
#: users/views/profile/face.py:78
|
||||
#, fuzzy
|
||||
#| msgid "OTP disable success"
|
||||
msgid "Face recognition disable success"
|
||||
msgstr "OTP無効化成功"
|
||||
|
||||
#: users/views/profile/face.py:79
|
||||
#, fuzzy
|
||||
#| msgid "OTP disable success, return login page"
|
||||
msgid "Face recognition disable success, return login page"
|
||||
msgstr "OTP無効化成功、ログインページを返す"
|
||||
|
||||
#: users/views/profile/otp.py:106
|
||||
msgid "Already bound"
|
||||
msgstr "すでにバインド済み"
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: JumpServer 0.3.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-19 15:05+0800\n"
|
||||
"POT-Creation-Date: 2024-11-19 16:36+0800\n"
|
||||
"PO-Revision-Date: 2021-05-20 10:54+0800\n"
|
||||
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
||||
"Language-Team: JumpServer team<ibuler@qq.com>\n"
|
||||
|
@ -9710,6 +9710,22 @@ msgstr "认证成功"
|
|||
msgid "Redirecting to JumpServer Client"
|
||||
msgstr ""
|
||||
|
||||
#: users/views/profile/face.py:54
|
||||
msgid "Face recognition enable success"
|
||||
msgstr "MFA(人脸识别) 开启成功"
|
||||
|
||||
#: users/views/profile/face.py:55
|
||||
msgid "Face recognition enable success, return login page"
|
||||
msgstr "MFA(人脸识别) 启用成功,返回到登录页面"
|
||||
|
||||
#: users/views/profile/face.py:78
|
||||
msgid "Face recognition disable success"
|
||||
msgstr "MFA(人脸识别) 禁用成功"
|
||||
|
||||
#: users/views/profile/face.py:79
|
||||
msgid "Face recognition disable success, return login page"
|
||||
msgstr "MFA(人脸识别) 禁用成功,返回登录页面"
|
||||
|
||||
#: users/views/profile/otp.py:106
|
||||
msgid "Already bound"
|
||||
msgstr "已经绑定"
|
||||
|
|
|
@ -7,7 +7,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: JumpServer 0.3.3\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-11-19 15:05+0800\n"
|
||||
"POT-Creation-Date: 2024-11-19 16:36+0800\n"
|
||||
"PO-Revision-Date: 2021-05-20 10:54+0800\n"
|
||||
"Last-Translator: ibuler <ibuler@qq.com>\n"
|
||||
"Language-Team: JumpServer team<ibuler@qq.com>\n"
|
||||
|
@ -9741,6 +9741,30 @@ msgstr "認證資料庫"
|
|||
msgid "Redirecting to JumpServer Client"
|
||||
msgstr ""
|
||||
|
||||
#: users/views/profile/face.py:54
|
||||
#, fuzzy
|
||||
#| msgid "Basic edition"
|
||||
msgid "Face recognition enable success"
|
||||
msgstr "企業基礎版"
|
||||
|
||||
#: users/views/profile/face.py:55
|
||||
#, fuzzy
|
||||
#| msgid "OTP enable success, return login page"
|
||||
msgid "Face recognition enable success, return login page"
|
||||
msgstr "MFA(OTP) 啟用成功,返回到登入頁面"
|
||||
|
||||
#: users/views/profile/face.py:78
|
||||
#, fuzzy
|
||||
#| msgid "OTP disable success"
|
||||
msgid "Face recognition disable success"
|
||||
msgstr "MFA(OTP) 禁用成功"
|
||||
|
||||
#: users/views/profile/face.py:79
|
||||
#, fuzzy
|
||||
#| msgid "OTP disable success, return login page"
|
||||
msgid "Face recognition disable success, return login page"
|
||||
msgstr "MFA(OTP) 禁用成功,返回登入頁面"
|
||||
|
||||
#: users/views/profile/otp.py:106
|
||||
msgid "Already bound"
|
||||
msgstr "已經綁定"
|
||||
|
|
|
@ -2,6 +2,7 @@ from django.contrib.auth import logout as auth_logout
|
|||
from django.shortcuts import redirect
|
||||
from django.views.generic import FormView
|
||||
from django import forms
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from authentication import errors
|
||||
from authentication.mixins import AuthMixin, MFAFaceMixin
|
||||
|
@ -9,6 +10,8 @@ from authentication.mixins import AuthMixin, MFAFaceMixin
|
|||
__all__ = ['UserFaceCaptureView', 'UserFaceEnableView',
|
||||
'UserFaceDisableView']
|
||||
|
||||
from common.utils import reverse, FlashMessageUtil
|
||||
|
||||
|
||||
class UserFaceCaptureForm(forms.Form):
|
||||
code = forms.CharField(label='MFA Code', max_length=128, required=False)
|
||||
|
@ -21,7 +24,7 @@ class UserFaceCaptureView(AuthMixin, FormView):
|
|||
code = ''
|
||||
|
||||
def form_valid(self, form):
|
||||
raise NotImplementedError
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data()
|
||||
|
@ -44,7 +47,17 @@ class UserFaceEnableView(UserFaceCaptureView, MFAFaceMixin):
|
|||
user.save(update_fields=['face_vector'])
|
||||
|
||||
auth_logout(self.request)
|
||||
return redirect('authentication:login')
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_success_url(self):
|
||||
message_data = {
|
||||
'title': _('Face recognition enable success'),
|
||||
'message': _('Face recognition enable success, return login page'),
|
||||
'interval': 5,
|
||||
'redirect_url': reverse('authentication:login'),
|
||||
}
|
||||
url = FlashMessageUtil.gen_message_url(message_data)
|
||||
return url
|
||||
|
||||
|
||||
class UserFaceDisableView(UserFaceCaptureView):
|
||||
|
@ -54,9 +67,19 @@ class UserFaceDisableView(UserFaceCaptureView):
|
|||
user = self.get_user_from_session()
|
||||
user.face_vector = None
|
||||
user.save(update_fields=['face_vector'])
|
||||
auth_logout(self.request)
|
||||
except (errors.MFAFailedError, errors.BlockMFAError) as e:
|
||||
form.add_error('code', e.msg)
|
||||
return super().form_invalid(form)
|
||||
|
||||
return redirect('authentication:login')
|
||||
auth_logout(self.request)
|
||||
return super().form_valid(form)
|
||||
|
||||
def get_success_url(self):
|
||||
message_data = {
|
||||
'title': _('Face recognition disable success'),
|
||||
'message': _('Face recognition disable success, return login page'),
|
||||
'interval': 5,
|
||||
'redirect_url': reverse('authentication:login'),
|
||||
}
|
||||
url = FlashMessageUtil.gen_message_url(message_data)
|
||||
return url
|
||||
|
|
Loading…
Reference in New Issue