Front and rear ends are not separated forgot password python

 

 

 

 

The first step to render find_password.html

# 1. The reception parameters image_code uuid

# 2. Verify the username and CAPTCHA 

user = User.objects.get(username=username)

Remove the redis uuid get redis_img_code than if image_code.lower () = redis_img_code.decode () lower ()!.:

# Generate a random string stored in redis 64 yards for the next submission in preparation to send text messages

# Generate a random code 

# Set valid

#encryption

# Returns a response

 

The second step to send text messages   

The new interface to obtain verification code SMS (text messaging previous registration page can not be used)

# 1. Receive access_token decryption check the accuracy of  

# Decrypt incoming front-end

# Get back verify_image_code stored connection from the mobile phone according to the comparison and then redis taken redis_random_token

# 3 * 6 generates a random message authentication code content random.randit ()  

4. * # 6 stored randomly inside redis (step 3) taken # connection sms_code

# 1. Obtain identify frequently send text messages

 # 2. determine whether there is identity

# 3. The symbol does not exist, the countdown again (pipeline)

# 4. Using asynchronous celery texting --- third-party content linked or Ali cloud cloud

# 5 returns a response

The second submission Next

#拿到sms_code = request.GET.get('sms_code')

# 1. check the phone number

# 2 check codes (step 3)

3. Return # # 1redis get the correct response verify_image_code, 2 get the encryption decoding redis_random_token 3 access_token = SecretOauth () by the mobile. Dumps (redis_random_token.decode ())

The third step is to submit

获取参数 json_dict password password2 access_token

#判空

# 解密前端 传入的

#判断密码

# *   3.确认密码: ---------判空,判断是否相等

#4.三步判断

# 5.更新密码 

user.set_password(password)   user.save()

# 6.返回响应  密码设置成功  跳回登录页面重新登录

Guess you like

Origin www.cnblogs.com/weather99-99/p/12057031.html