Skip to content

Commit

Permalink
feat: remove mfa check when unbind face code
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron3S authored and BaiJiangJie committed Dec 19, 2024
1 parent 2956f2e commit 5a14bb1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/users/views/profile/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ def get_success_url(self):
class UserFaceDisableView(UserFaceCaptureView):
def form_valid(self, form):
try:
self._do_check_user_mfa(self.code, self.mfa_type)
code = self.get_face_code()
user = self.get_user_from_session()
if not user.check_face(code):
raise Exception(_('Facial comparison failed'))
user.face_vector = None
user.save(update_fields=['face_vector'])
except (errors.MFAFailedError, errors.BlockMFAError) as e:
form.add_error('code', e.msg)
except Exception as e:
form.add_error('code', str(e))
return super().form_invalid(form)
return super().form_valid(form)

Expand Down

0 comments on commit 5a14bb1

Please sign in to comment.