|
@@ -3391,10 +3391,16 @@ class SingleLoginView(TemplateView):
|
|
phone = request_dict.get('phone', None)
|
|
phone = request_dict.get('phone', None)
|
|
sign_name = request_dict.get('sign_name', None)
|
|
sign_name = request_dict.get('sign_name', None)
|
|
country_code = request_dict.get('country_code', None)
|
|
country_code = request_dict.get('country_code', None)
|
|
|
|
+ # code_type = 1 表示修改绑定手机号
|
|
|
|
+ code_type = request_dict.get('code_type', None)
|
|
if email is not None:
|
|
if email is not None:
|
|
email = email.strip()
|
|
email = email.strip()
|
|
# 阿里云的发送邮箱的调用方法
|
|
# 阿里云的发送邮箱的调用方法
|
|
return self.get_aliyun_email_code(email, response)
|
|
return self.get_aliyun_email_code(email, response)
|
|
|
|
+ elif phone is not None and code_type == 1:
|
|
|
|
+ phone = phone.strip()
|
|
|
|
+ country_code = str(country_code.strip())
|
|
|
|
+ return self.get_change_phone_code(country_code, phone, response, sign_name)
|
|
elif phone is not None:
|
|
elif phone is not None:
|
|
phone = phone.strip()
|
|
phone = phone.strip()
|
|
country_code = str(country_code.strip())
|
|
country_code = str(country_code.strip())
|
|
@@ -3561,6 +3567,42 @@ class SingleLoginView(TemplateView):
|
|
return response.json(10, '删除缓存失败')
|
|
return response.json(10, '删除缓存失败')
|
|
return response.json(0)
|
|
return response.json(0)
|
|
|
|
|
|
|
|
+ @staticmethod
|
|
|
|
+ def get_change_phone_code(country_code, phone, response, sign_name):
|
|
|
|
+ data_valid = DataValid()
|
|
|
|
+ if data_valid.mobile_validate(phone) is not True:
|
|
|
|
+ return response.json(107)
|
|
|
|
+ reds = RedisObject()
|
|
|
|
+ reds_key = str(phone) + '_ChangePhone'
|
|
|
|
+ identifying_code = reds.get_data(key=reds_key)
|
|
|
|
+ reds_key_ttl = reds.get_ttl(key=reds_key)
|
|
|
|
+ if reds_key_ttl > 240 and identifying_code:
|
|
|
|
+ return response.json(90)
|
|
|
|
+ identifying_code = RandomStr(6, True)
|
|
|
|
+ if country_code == '86':
|
|
|
|
+ # 国内短信推送模板
|
|
|
|
+ temp_msg = 'SMS_151675018'
|
|
|
|
+ rec_phone = phone
|
|
|
|
+ if sign_name == 'zosi':
|
|
|
|
+ sign_ms = '周视'
|
|
|
|
+ else:
|
|
|
|
+ sign_ms = 'Ansjer'
|
|
|
|
+ else:
|
|
|
|
+ # 国际短信推送模板
|
|
|
|
+ temp_msg = 'SMS_172165867'
|
|
|
|
+ rec_phone = country_code + phone
|
|
|
|
+ sign_ms = 'Ansjer'
|
|
|
|
+
|
|
|
|
+ # 发送手机验证码
|
|
|
|
+ alisms = AliSmsObject()
|
|
|
|
+ res = alisms.send_code_sms(phone=rec_phone, code=identifying_code, sign_name=sign_ms, temp_msg=temp_msg)
|
|
|
|
+ if res["Code"] == "OK":
|
|
|
|
+ if reds.set_data(key=reds_key, val=identifying_code, expire=300) is not True:
|
|
|
|
+ return response.json(10, '生成缓存系统错误')
|
|
|
|
+ return response.json(0)
|
|
|
|
+ else:
|
|
|
|
+ return response.json(10, res["Message"])
|
|
|
|
+
|
|
|
|
|
|
class UnbundingWXView(TemplateView):
|
|
class UnbundingWXView(TemplateView):
|
|
|
|
|
|
@@ -5061,54 +5103,13 @@ class ChangeAccountInfoView(View):
|
|
|
|
|
|
def validation(self, request_dict, request, operation):
|
|
def validation(self, request_dict, request, operation):
|
|
response = ResponseObject()
|
|
response = ResponseObject()
|
|
- if operation == 'sendPhoneCode':
|
|
|
|
- return self.send_phone_code(request_dict, response)
|
|
|
|
- elif operation == 'verifyCode':
|
|
|
|
|
|
+ if operation == 'verifyCode':
|
|
return self.verify_code(request_dict, response)
|
|
return self.verify_code(request_dict, response)
|
|
elif operation == 'changePhone':
|
|
elif operation == 'changePhone':
|
|
return self.change_phone(request_dict, response)
|
|
return self.change_phone(request_dict, response)
|
|
else:
|
|
else:
|
|
return response.json(444)
|
|
return response.json(444)
|
|
|
|
|
|
- @staticmethod
|
|
|
|
- def send_phone_code(request_dict, response):
|
|
|
|
- phone = request_dict.get('phone', None)
|
|
|
|
- sign_name = request_dict.get('sign_name', None)
|
|
|
|
- country_code = request_dict.get('country_code', None)
|
|
|
|
- data_valid = DataValid()
|
|
|
|
- if data_valid.mobile_validate(phone) is not True:
|
|
|
|
- return response.json(107)
|
|
|
|
- reds = RedisObject()
|
|
|
|
- reds_key = str(phone) + '_ChangePhone'
|
|
|
|
- identifying_code = reds.get_data(key=reds_key)
|
|
|
|
- reds_key_ttl = reds.get_ttl(key=reds_key)
|
|
|
|
- if reds_key_ttl > 240 and identifying_code:
|
|
|
|
- return response.json(90)
|
|
|
|
- identifying_code = RandomStr(6, True)
|
|
|
|
- if country_code == '86':
|
|
|
|
- # 国内短信推送模板
|
|
|
|
- temp_msg = 'SMS_151675018'
|
|
|
|
- rec_phone = phone
|
|
|
|
- if sign_name == 'zosi':
|
|
|
|
- sign_ms = '周视'
|
|
|
|
- else:
|
|
|
|
- sign_ms = 'Ansjer'
|
|
|
|
- else:
|
|
|
|
- # 国际短信推送模板
|
|
|
|
- temp_msg = 'SMS_172165867'
|
|
|
|
- rec_phone = country_code + phone
|
|
|
|
- sign_ms = 'Ansjer'
|
|
|
|
-
|
|
|
|
- # 发送手机验证码
|
|
|
|
- alisms = AliSmsObject()
|
|
|
|
- res = alisms.send_code_sms(phone=rec_phone, code=identifying_code, sign_name=sign_ms, temp_msg=temp_msg)
|
|
|
|
- if res["Code"] == "OK":
|
|
|
|
- if reds.set_data(key=reds_key, val=identifying_code, expire=300) is not True:
|
|
|
|
- return response.json(10, '生成缓存系统错误')
|
|
|
|
- return response.json(0)
|
|
|
|
- else:
|
|
|
|
- return response.json(10, res["Message"])
|
|
|
|
-
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
def verify_code(request_dict, response):
|
|
def verify_code(request_dict, response):
|
|
phone = request_dict.get('phone', None)
|
|
phone = request_dict.get('phone', None)
|