예제 #1
0
    def save(self, **kwargs):
        up = self.user
        rand_code = random.randint(1000, 9999)
        if not self.sms_code:
            if up.mobile != '+19999999999':
                self.sms_code = rand_code
            else:
                self.sms_code = '9999'
            if settings.DEBUG:
                print(self.sms_code)

        now = timezone.now()
        expires = now + timedelta(minutes=settings.SMS_LOGIN_TIMEOUT_MIN)
        self.expires = expires

        # Removing mfa check.
        # Only call ValidSMSCode is user.MFA is true or Verifying phone
        phone_email = cell_email(up.mobile, up.carrier)
        # send an sms code
        self.send_outcome = send_sms_pin(phone_email, self.sms_code)

        super(ValidSMSCode, self).save(**kwargs)
예제 #2
0
    def save(self, **kwargs):
        up = self.user
        rand_code = random.randint(1000, 9999)
        if not self.sms_code:
            if up.mobile != '+19999999999':
                self.sms_code = rand_code
            else:
                self.sms_code = '9999'
            if settings.DEBUG:
                print(self.sms_code)

        now = timezone.now()
        expires = now + timedelta(minutes=settings.SMS_LOGIN_TIMEOUT_MIN)
        self.expires = expires

        if up.mfa:
            new_number = cell_email(up.mobile, up.carrier)
            #send an sms code
            self.send_outcome = send_sms_pin(up.mobile, new_number,
                                             self.sms_code)
        else:
            self.send_outcome = ''
        super(ValidSMSCode, self).save(**kwargs)
예제 #3
0
    def save(self, **kwargs):
        up = self.user
        rand_code = random.randint(1000, 9999)
        if not self.sms_code:
            if up.mobile != '+19999999999':
                self.sms_code = rand_code
            else:
                self.sms_code = '9999'
            if settings.DEBUG:
                print(self.sms_code)

        now = timezone.now()
        expires = now + timedelta(minutes=settings.SMS_LOGIN_TIMEOUT_MIN)
        self.expires = expires

        # Removing mfa check.
        # Only call ValidSMSCode is user.MFA is true or Verifying phone
        phone_email = cell_email(up.mobile, up.carrier)
        # send an sms code
        self.send_outcome = send_sms_pin(phone_email,
                                         self.sms_code)

        super(ValidSMSCode, self).save(**kwargs)
예제 #4
0
    def save(self, **kwargs):
        up=self.user
        rand_code=random.randint(1000,9999)
        if not self.sms_code:
            if up.mobile != '+19999999999':
                self.sms_code = rand_code
            else:
                self.sms_code = '9999'
            if settings.DEBUG:
                print(self.sms_code)

        now = timezone.now()
        expires = now + timedelta(minutes=settings.SMS_LOGIN_TIMEOUT_MIN)
        self.expires = expires

        if up.mfa:
            new_number = cell_email(up.mobile, up.carrier)
            #send an sms code
            self.send_outcome = send_sms_pin(up.mobile,
                                             new_number,
                                             self.sms_code )
        else:
            self.send_outcome = ''
        super(ValidSMSCode, self).save(**kwargs)