This commit is contained in:
Sayyid Hamid Mahdavi 2020-11-18 12:43:38 +03:30
parent 90e8d04813
commit 659de23863
2 changed files with 1 additions and 15 deletions

View file

@ -15,7 +15,6 @@ from .provinces_and_cities import state
from .tasks import send_notification
from apps.users.constans import MAX_OTP_TRY, DEVELOPMENT_PHONE_NUMBERS
from .validators import PhoneNumberValidator
class UserManager(BaseUserManager):
@ -107,8 +106,7 @@ class User(AbstractUser):
blank=True,
null=True
)
phone_number = models.CharField(_('phone number'), max_length=30, blank=True, null=True, unique=True,
validators=[PhoneNumberValidator],)
phone_number = models.CharField(_('phone number'), max_length=30, blank=True, null=True, unique=True)
otp = models.CharField(_('otp'), max_length=6, blank=True, null=True)
otp_expire = models.DateTimeField(_('otp expire'), blank=True, null=True)
otp_try = models.IntegerField(_('otp try'), blank=True, null=True, default=0)

View file

@ -1,12 +0,0 @@
from django.core import validators
from django.utils.deconstruct import deconstructible
from django.utils.translation import gettext_lazy as _
@deconstructible
class PhoneNumberValidator(validators.RegexValidator):
regex = r'^\+98\d{10,10}$'
message = _(
"Phone number must be entered in the format: '+989999999999'."
)
flags = 0