示例#1
0
 def validate_phone(self, phone):
     code = generate_code(6)
     # TODO: Send sms
     # sms_body = f'Your authorization code: {code}'
     cache.set(phone, code, timeout=900)
     if settings.DEBUG:
         return code
     return phone
示例#2
0
    def create_email_change_code(self, user, email):
        code = generate_code()
        email_change_code = self.create(user=user, code=code, email=email)

        return email_change_code
示例#3
0
 def create_signup_code(self, user, ip_address):
     code = generate_code()
     signup_code = self.create(user=user, code=code, ip_address=ip_address)
     return signup_code
示例#4
0
 def create_password_reset_code(self, user):
     code = generate_code()
     password_reset_code = self.create(user=user, code=code)
     return password_reset_code
示例#5
0
 def generate_enter_code(self):
     self.enter_code = generate_code(6)
     self.save()