2023-07-24 03:52:25 +00:00
|
|
|
from django.utils.translation import gettext_lazy as _
|
2022-07-04 03:29:39 +00:00
|
|
|
|
|
|
|
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
|
2023-10-10 09:52:52 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def content(self):
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
'name': 'password',
|
|
|
|
'display_name': _('Password'),
|
|
|
|
'disabled': False,
|
|
|
|
'placeholder': _('Password'),
|
|
|
|
}
|
|
|
|
]
|