hash otp
This commit is contained in:
parent
f2e8777e6d
commit
2cf5ab4cb7
1 changed files with 2 additions and 2 deletions
|
|
@ -5,7 +5,7 @@ from datetime import timedelta
|
|||
# import service_clients
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.base_user import BaseUserManager
|
||||
from django.contrib.auth.hashers import make_password
|
||||
from django.contrib.auth.hashers import make_password, check_password
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
from django.contrib.auth.validators import UnicodeUsernameValidator
|
||||
from django.db import models
|
||||
|
|
@ -180,7 +180,7 @@ class User(AbstractUser):
|
|||
|
||||
def check_otp(self, otp):
|
||||
if self.otp_try <= MAX_OTP_TRY:
|
||||
result = otp and self.otp == otp and self.otp_is_valid()
|
||||
result = otp and check_password(self.otp, otp) and self.otp_is_valid()
|
||||
if result:
|
||||
self.otp = None
|
||||
self.date_joined = timezone.now()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue