mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-04 08:55:40 +00:00
perf: 优化confirm接口 (#8451)
* perf: 优化confirm接口 * perf: 修改 校验 * perf: 优化 confirm API 逻辑 * Delete django.po Co-authored-by: feng626 <1304903146@qq.com> Co-authored-by: ibuler <ibuler@qq.com> Co-authored-by: Jiangjie.Bai <bugatti_it@163.com> Co-authored-by: feng626 <57284900+feng626@users.noreply.github.com>
This commit is contained in:
17
apps/authentication/confirm/password.py
Normal file
17
apps/authentication/confirm/password.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from authentication.mixins import authenticate
|
||||
from .base import BaseConfirm
|
||||
|
||||
|
||||
class ConfirmPassword(BaseConfirm):
|
||||
name = 'password'
|
||||
display_name = _('Password')
|
||||
|
||||
def check(self):
|
||||
return self.user.is_password_authenticate()
|
||||
|
||||
def authenticate(self, secret_key, mfa_type):
|
||||
ok = authenticate(self.request, username=self.user.username, password=secret_key)
|
||||
msg = '' if ok else _('Authentication failed password incorrect')
|
||||
return ok, msg
|
Reference in New Issue
Block a user