Skip to content

Commit

Permalink
delete otp session auth factor
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Sep 29, 2023
1 parent 89f39c1 commit 073c961
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions codeforlife/user/auth/backends/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ def authenticate(

for backup_token in request.user.backup_tokens.all():
if backup_token.check_token(token):
# Delete OTP auth factor from session.
request.user.session.session_auth_factors.filter(
auth_factor__type=AuthFactor.Type.OTP
).delete()

return request.user

def get_user(self, user_id: int):
Expand Down

0 comments on commit 073c961

Please sign in to comment.