密码校验
This commit is contained in:
@@ -93,7 +93,10 @@ public class UserInfoController {
|
|||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "UserInfo", value = "待添加的UserInfo实例", paramType = "body", dataType = "UserInfo", required = true)})
|
@ApiImplicitParam(name = "UserInfo", value = "待添加的UserInfo实例", paramType = "body", dataType = "UserInfo", required = true)})
|
||||||
public Result<Object> add(@RequestBody UserInfo userInfo) {
|
public Result<Object> add(@RequestBody UserInfo userInfo) {
|
||||||
userInfo.getPassword();
|
String s = StringUtil.passwordCheck(userInfo.getPassword());
|
||||||
|
if (s == null){
|
||||||
|
return ResultGenerator.genFailResult("密码不合规");
|
||||||
|
}
|
||||||
userInfoNewService.register(userInfo);
|
userInfoNewService.register(userInfo);
|
||||||
return ResultGenerator.genSuccessResult();
|
return ResultGenerator.genSuccessResult();
|
||||||
}
|
}
|
||||||
@@ -139,6 +142,10 @@ public class UserInfoController {
|
|||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "UserInfo", value = "更新的UserInfo实例", paramType = "body", dataType = "UserInfo", required = true),})
|
@ApiImplicitParam(name = "UserInfo", value = "更新的UserInfo实例", paramType = "body", dataType = "UserInfo", required = true),})
|
||||||
public Result<Object> forgetPassword(@RequestBody UserInfo userInfo) {
|
public Result<Object> forgetPassword(@RequestBody UserInfo userInfo) {
|
||||||
|
String s = StringUtil.passwordCheck(userInfo.getPassword());
|
||||||
|
if (s == null){
|
||||||
|
return ResultGenerator.genFailResult("密码不合规");
|
||||||
|
}
|
||||||
userInfoNewService.forgetPwd(userInfo);
|
userInfoNewService.forgetPwd(userInfo);
|
||||||
return ResultGenerator.genSuccessResult();
|
return ResultGenerator.genSuccessResult();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -383,8 +383,12 @@ public class StringUtil extends StringUtils {
|
|||||||
* @param password
|
* @param password
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
// public static String passwordCheck(String password){
|
public static String passwordCheck(String password){
|
||||||
// int length = password.length();
|
int length = password.length();
|
||||||
// if (length)
|
if (length >= 7 && length <= 16){
|
||||||
// }
|
return password;
|
||||||
|
}else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user