忘记密码获取验证码
This commit is contained in:
@@ -17,6 +17,9 @@ public class SmsEnum {
|
||||
@Value("${redis.key.prefix.loginCode}")
|
||||
private static String REDIS_KEY_PREFIX_LOGIN_CODE;
|
||||
|
||||
@Value("${redis.key.prefix.forgetCode}")
|
||||
private static String REDIS_KEY_PREFIX_FORGET_CODE;
|
||||
|
||||
|
||||
/**
|
||||
* 发送验证码
|
||||
@@ -27,6 +30,7 @@ public class SmsEnum {
|
||||
* 登录
|
||||
*/
|
||||
LOGIN("1", REDIS_KEY_PREFIX_LOGIN_CODE,"登录"),
|
||||
FORGET("2", REDIS_KEY_PREFIX_FORGET_CODE,"忘记密码"),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -67,6 +67,9 @@ public class SingelHomeController {
|
||||
|
||||
@Value("${redis.key.prefix.loginCode}")
|
||||
private String REDIS_KEY_PREFIX_LOGIN_CODE;
|
||||
|
||||
@Value("${redis.key.prefix.forgetCode}")
|
||||
private String REDIS_KEY_PREFIX_FORGET_CODE;
|
||||
@Autowired
|
||||
OssAliyunUtil aliyunOSSUtil;
|
||||
@Value("${jwt.tokenHeader}")
|
||||
@@ -443,7 +446,7 @@ public class SingelHomeController {
|
||||
@IgnoreAuth
|
||||
@ApiOperation("获取验证码")
|
||||
@PostMapping(value = "/sms/codes")
|
||||
public Object sendSmsCode(@RequestParam("phone") String phone,@RequestParam("type")String type) {
|
||||
public Object sendSmsCode(@RequestParam("phone") String phone,@RequestParam(value = "type")String type) {
|
||||
try {
|
||||
if (!PhoneUtil.checkPhone(phone)) {
|
||||
throw new IllegalArgumentException("手机号格式不正确");
|
||||
@@ -455,7 +458,8 @@ public class SingelHomeController {
|
||||
String redisKey = "";
|
||||
if(SmsEnum.SendEnum.LOGIN.getCode().equals(type)){
|
||||
redisKey = REDIS_KEY_PREFIX_LOGIN_CODE;
|
||||
// redisKey = SmsEnum.SendEnum.LOGIN.getRedisKey();
|
||||
}else if(SmsEnum.SendEnum.FORGET.getCode().equals(type)){
|
||||
redisKey = REDIS_KEY_PREFIX_FORGET_CODE;
|
||||
}
|
||||
Date date = new Date();
|
||||
String codeRedis = redisService.get(redisKey + phone);
|
||||
|
||||
@@ -113,6 +113,8 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
|
||||
private String REDIS_KEY_PREFIX_AUTH_CODE;
|
||||
@Value("${redis.key.prefix.loginCode}")
|
||||
private String REDIS_KEY_PREFIX_LOGIN_CODE;
|
||||
@Value("${redis.key.prefix.forgetCode}")
|
||||
private String REDIS_KEY_PREFIX_FORGET_CODE;
|
||||
@Value("${authCode.expire.seconds}")
|
||||
private Long AUTH_CODE_EXPIRE_SECONDS;
|
||||
@Value("${jwt.tokenHead}")
|
||||
@@ -451,8 +453,10 @@ public class UmsMemberServiceImpl extends ServiceImpl<UmsMemberMapper, UmsMember
|
||||
String redisKey = "";
|
||||
if (SmsEnum.SendEnum.LOGIN.getCode().equals(type)) {
|
||||
content = "验证码:" + code + ",用于登录App,有效期5分钟,如非本人操作,请忽略该短信。";
|
||||
// redisKey = SmsEnum.SendEnum.LOGIN.getRedisKey();
|
||||
redisKey = REDIS_KEY_PREFIX_LOGIN_CODE;
|
||||
}else if (SmsEnum.SendEnum.FORGET.getCode().equals(type)){
|
||||
content = "验证码:" + code + ",用于修改登录密码,有效期5分钟,如非本人操作,请忽略该短信。";
|
||||
redisKey = REDIS_KEY_PREFIX_FORGET_CODE;
|
||||
}
|
||||
String result = SmsConfig.SendWaitWorkMsg(phone, code, content);
|
||||
if ("1".equals(result)) {
|
||||
|
||||
@@ -10,6 +10,7 @@ server.port=8111
|
||||
#===redis custom key start===
|
||||
redis.key.prefix.authCode=portal:authCode:
|
||||
redis.key.prefix.loginCode=portal:loginCode:
|
||||
redis.key.prefix.forgetCode=portal:forgetCode:
|
||||
redis.key.prefix.orderId=portal:orderId:
|
||||
authCode.expire.seconds=90
|
||||
#===redis custom key end===
|
||||
|
||||
Reference in New Issue
Block a user