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
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
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
def create_password_reset_code(self, user): code = generate_code() password_reset_code = self.create(user=user, code=code) return password_reset_code
def generate_enter_code(self): self.enter_code = generate_code(6) self.save()