random password

This commit is contained in:
Sayyid Hamid Mahdavi 2026-02-15 10:24:38 +03:30
parent d4bb5ed6b6
commit 27faf23bec

View file

@ -154,8 +154,8 @@ class User(AbstractUser):
def set_otp(self):
if self.otp_expire and (self.otp_expire + timedelta(seconds=MAX_OTP_VALID_DURATION)) > timezone.now():
raise Exception(_('otp expire time not reached.'))
# self._otp = ''.join(random.choice('0123456789') for _ in range(5))
self._otp = '77501'
self._otp = ''.join(random.choice('0123456789') for _ in range(5))
# self._otp = '77501'
self.otp = make_password(self._otp)
self.otp_expire = timezone.now() + timedelta(seconds=MAX_OTP_VALID_DURATION)
self.otp_try = 0