Commit 6302496a authored by zhangfeng's avatar zhangfeng

feat(600): 分享页面注册

parent 06c1fc20
......@@ -50,11 +50,24 @@ public class AppAuthController {
// if (StringUtils.isNotBlank(mobile)) {
// reqVO.setMobile(mobile);
// }
String token = authService.reg(reqVO, getClientIP(), getUserAgent());
String token = authService.reg(reqVO, getClientIP(), getUserAgent(), true);
// 返回结果
return success(AppAuthLoginRespVO.builder().token(token).build());
}
@PostMapping("/share-page/reg")
@ApiOperation("分享页面使用手机注册")
@OperateLog(enable = false)
@Idempotent(timeout = 5)
public CommonResult<Boolean> sharePageReg(@RequestBody @Valid AppAuthRegReqVO reqVO) {
String mobileCode = reqVO.getAreaCode() + StrUtil.COLON + reqVO.getMobile();
paramValidatorApi.validatorMobile(mobileCode);
authService.reg(reqVO, getClientIP(), getUserAgent(), false);
// 返回结果
return success(true);
}
@PostMapping("/login")
@ApiOperation("使用手机 + 密码登录")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
......@@ -110,7 +123,7 @@ public class AppAuthController {
}
@PostMapping("/update-password")
@ApiOperation(value = "修改用户密码",notes = "用户修改密码时使用")
@ApiOperation(value = "修改用户密码", notes = "用户修改密码时使用")
@PreAuthenticated
@Idempotent(timeout = 5)
public CommonResult<Boolean> updatePassword(@RequestBody @Valid AppAuthUpdatePasswordReqVO reqVO) {
......@@ -129,7 +142,7 @@ public class AppAuthController {
}
@PostMapping("/update-control-password")
@ApiOperation(value = "修改用户控货密码",notes = "用户修改控货密码时使用")
@ApiOperation(value = "修改用户控货密码", notes = "用户修改控货密码时使用")
@PreAuthenticated
public CommonResult<Boolean> updateControlPassword(@RequestBody @Valid AppAuthUpdatePasswordReqVO reqVO) {
authService.updateControlPassword(getLoginUserId(), reqVO);
......
......@@ -22,7 +22,7 @@ public interface MemberAuthService extends SecurityAuthFrameworkService {
* @param userAgent 用户 UA
* @return 身份令牌,使用 JWT 方式
*/
String reg(@Valid AppAuthRegReqVO reqVO, String userIp, String userAgent);
String reg(@Valid AppAuthRegReqVO reqVO, String userIp, String userAgent, Boolean isAutoLogin);
/**
* 检查号码是否唯一
......
......@@ -111,7 +111,7 @@ public class MemberAuthServiceImpl implements MemberAuthService {
}
@Override
public String reg(@Valid AppAuthRegReqVO reqVO, String userIp, String userAgent) {
public String reg(@Valid AppAuthRegReqVO reqVO, String userIp, String userAgent, Boolean isAutoLogin) {
// 校验验证码
smsCodeApi.useSmsCode(AuthConvert.INSTANCE.convert(reqVO, SmsSceneEnum.MEMBER_REG.getScene(), userIp));
......@@ -134,6 +134,9 @@ public class MemberAuthServiceImpl implements MemberAuthService {
.setContent("手机注册成功");
userOperationLogService.createUserOperationLog(userOperationLogCreateReqVO);
if (!isAutoLogin) {
return null;
}
// 执行登陆
this.createLoginLog(user.getMobile(), LoginLogTypeEnum.LOGIN_USERNAME, LoginResultEnum.SUCCESS);
LoginUser loginUser = AuthConvert.INSTANCE.convert(user);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment