增加手机+密码+验证码注册方式

This commit is contained in:
wanggeng 2023-03-15 16:27:43 +08:00
parent 680a39acbf
commit 3a8ebd6add
2 changed files with 58 additions and 4 deletions

View File

@ -8,10 +8,7 @@ import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.interfaces.sms.ISmsBaseService;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResult;
import ink.wgink.register.base.pojo.vos.RegisterDefaultVO;
import ink.wgink.register.base.pojo.vos.RegisterDefaultWithExpandInfoVO;
import ink.wgink.register.base.pojo.vos.RegisterPhoneVO;
import ink.wgink.register.base.pojo.vos.RegisterPhoneWithExpandInfoVO;
import ink.wgink.register.base.pojo.vos.*;
import ink.wgink.register.base.service.IRegisterService;
import ink.wgink.util.RegexUtil;
import io.swagger.annotations.Api;
@ -69,6 +66,26 @@ public class RegisterAppController extends DefaultBaseController {
return new SuccessResult();
}
@ApiOperation(value = "手机密码注册", notes = "手机注册,手机 + 短信验证码 + 密码接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("phone-password")
@CheckRequestBodyAnnotation
public synchronized SuccessResult phonePassword(@RequestBody RegisterPhonePasswordVO registerPhonePasswordVO) throws Exception {
checkPhoneRegisterParams(registerPhonePasswordVO);
if (!StringUtils.equals(registerPhonePasswordVO.getPassword(), registerPhonePasswordVO.getPasswordSame())) {
throw new ParamsException("两次密码不一致");
}
if (!RegexUtil.isPasswordMiddle(registerPhonePasswordVO.getPassword())) {
throw new ParamsException("密码强度不够, 密码6到16位包含数字、字母、特殊字符其中的任意两种");
}
Map<String, Object> params = requestParams();
RegisterDefaultVO registerDefaultVO = new RegisterDefaultVO();
registerDefaultVO.setUsername(registerPhonePasswordVO.getPhone());
registerDefaultVO.setPassword(registerPhonePasswordVO.getPassword());
registerService.registerDefault(registerDefaultVO, params);
return new SuccessResult();
}
@ApiOperation(value = "默认注册(有拓展信息)", notes = "默认注册(有拓展信息),用户名密码注册接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})

View File

@ -0,0 +1,37 @@
package ink.wgink.register.base.pojo.vos;
import ink.wgink.annotation.CheckEmptyAnnotation;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: RegisterPhonePasswordVO
* @Description:
* @Author: wanggeng
* @Date: 2023/3/15 16:20
* @Version: 1.0
*/
public class RegisterPhonePasswordVO extends RegisterPhoneVO{
@ApiModelProperty(name = "password", value = "密码")
@CheckEmptyAnnotation(name = "密码")
private String password;
@ApiModelProperty(name = "passwordSame", value = "相同密码")
@CheckEmptyAnnotation(name = "passwordSame")
private String passwordSame;
public String getPassword() {
return password == null ? "" : password.trim();
}
public void setPassword(String password) {
this.password = password;
}
public String getPasswordSame() {
return passwordSame == null ? "" : passwordSame.trim();
}
public void setPasswordSame(String passwordSame) {
this.passwordSame = passwordSame;
}
}