master
肖凡 2023-11-17 08:21:55 +08:00
parent a3c153fee6
commit ce5c492d7e
3 changed files with 21 additions and 0 deletions

6
.idea/vcs.xml 100644
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,6 +1,7 @@
package com.bwie.auth.service;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.A;
import com.bwie.auth.feign.UserFeignService;
import com.bwie.common.constants.JwtConstants;
import com.bwie.common.constants.RabbitMQQueueConstants;
@ -66,6 +67,13 @@ public class AuthServiceimpl implements AuthService{
if (!code.equals(loginRequest.getCode())){
return Result.error("验证码错误");
}
if (loginRequest.getUserPwd()==null){
return Result.error("密码不能为空");
}
if (!vailPwd(loginRequest.getUserPwd())){
return Result.error("密码格式错误");
}
String userKey = UUID.randomUUID().toString().replaceAll("-", "");
HashMap<String, Object> claims = new HashMap<>();
claims.put(JwtConstants.USER_KEY,userKey);
@ -91,4 +99,10 @@ public class AuthServiceimpl implements AuthService{
Pattern compile = Pattern.compile("^\\d{11}$");
return compile.matcher(phone).matches();
}
public Boolean vailPwd(String userPwd){
Pattern compile = Pattern.compile("\\S*(?=\\S{6,})(?=\\S*\\d)(?=\\S*[A-Z])(?=\\S*[a-z])(?=\\S*[!@#$%^&*? ])\\S*");
return compile.matcher(userPwd).matches();
}
}

View File

@ -6,4 +6,5 @@ import lombok.Data;
public class LoginRequest {
private String phone;
private String code;
private String userPwd;
}