|
@@ -23,7 +23,7 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti
|
|
|
|
|
|
@Api(tags = "用户 APP - 认证")
|
|
|
@RestController
|
|
|
-@RequestMapping("/member/")
|
|
|
+@RequestMapping("/member/auth")
|
|
|
@Validated
|
|
|
@Slf4j
|
|
|
public class AppAuthController {
|
|
@@ -33,7 +33,6 @@ public class AppAuthController {
|
|
|
|
|
|
@PostMapping("/login")
|
|
|
@ApiOperation("使用手机 + 密码登录")
|
|
|
- @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
|
|
public CommonResult<AppAuthLoginRespVO> login(@RequestBody @Valid AppAuthLoginReqVO reqVO) {
|
|
|
String token = authService.login(reqVO, getClientIP(), getUserAgent());
|
|
|
// 返回结果
|
|
@@ -42,7 +41,6 @@ public class AppAuthController {
|
|
|
|
|
|
@PostMapping("/sms-login")
|
|
|
@ApiOperation("使用手机 + 验证码登录")
|
|
|
- @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
|
|
public CommonResult<AppAuthLoginRespVO> smsLogin(@RequestBody @Valid AppAuthSmsLoginReqVO reqVO) {
|
|
|
String token = authService.smsLogin(reqVO, getClientIP(), getUserAgent());
|
|
|
// 返回结果
|
|
@@ -51,7 +49,6 @@ public class AppAuthController {
|
|
|
|
|
|
@PostMapping("/send-sms-code")
|
|
|
@ApiOperation(value = "发送手机验证码")
|
|
|
- @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
|
|
public CommonResult<Boolean> sendSmsCode(@RequestBody @Valid AppAuthSendSmsReqVO reqVO) {
|
|
|
authService.sendSmsCode(getLoginUserId(), reqVO);
|
|
|
return success(true);
|
|
@@ -60,7 +57,6 @@ public class AppAuthController {
|
|
|
@PostMapping("/reset-password")
|
|
|
@ApiOperation(value = "重置密码", notes = "用户忘记密码时使用")
|
|
|
@PreAuthenticated
|
|
|
- @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
|
|
public CommonResult<Boolean> resetPassword(@RequestBody @Valid AppAuthResetPasswordReqVO reqVO) {
|
|
|
authService.resetPassword(reqVO);
|
|
|
return success(true);
|
|
@@ -87,35 +83,18 @@ public class AppAuthController {
|
|
|
return CommonResult.success(authService.getSocialAuthorizeUrl(type, redirectUri));
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/social-login")
|
|
|
- @ApiOperation(value = "社交登录,使用 code 授权码", notes = "适合未登录的用户,但是社交账号已绑定用户")
|
|
|
- public CommonResult<AppAuthLoginRespVO> socialLogin(@RequestBody @Valid AppAuthSocialLoginReqVO reqVO) {
|
|
|
- String token = authService.socialLogin(reqVO, getClientIP(), getUserAgent());
|
|
|
+ @PostMapping("/social-quick-login")
|
|
|
+ @ApiOperation(value = "社交快捷登录,使用 code 授权码", notes = "适合未登录的用户,但是社交账号已绑定用户")
|
|
|
+ public CommonResult<AppAuthLoginRespVO> socialLogin(@RequestBody @Valid AppAuthSocialQuickLoginReqVO reqVO) {
|
|
|
+ String token = authService.socialQuickLogin(reqVO, getClientIP(), getUserAgent());
|
|
|
return success(AppAuthLoginRespVO.builder().token(token).build());
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/social-login2")
|
|
|
- @ApiOperation(value = "社交登录,使用 手机号 + 手机验证码", notes = "适合未登录的用户,进行登录 + 绑定")
|
|
|
- @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
|
|
- public CommonResult<AppAuthLoginRespVO> socialLogin2(@RequestBody @Valid AppAuthSocialLogin2ReqVO reqVO) {
|
|
|
- String token = authService.socialLogin2(reqVO, getClientIP(), getUserAgent());
|
|
|
+ @PostMapping("/social-bind-login")
|
|
|
+ @ApiOperation(value = "社交绑定登录,使用 手机号 + 手机验证码", notes = "适合未登录的用户,进行登录 + 绑定")
|
|
|
+ public CommonResult<AppAuthLoginRespVO> socialLogin2(@RequestBody @Valid AppAuthSocialBindLoginReqVO reqVO) {
|
|
|
+ String token = authService.socialBindLogin(reqVO, getClientIP(), getUserAgent());
|
|
|
return success(AppAuthLoginRespVO.builder().token(token).build());
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/social-bind")
|
|
|
- @ApiOperation(value = "社交绑定,使用 code 授权码", notes = "使用在用户已经登录的情况下")
|
|
|
- @PreAuthenticated
|
|
|
- public CommonResult<Boolean> socialBind(@RequestBody @Valid AppAuthSocialBindReqVO reqVO) {
|
|
|
- authService.socialBind(getLoginUserId(), reqVO);
|
|
|
- return CommonResult.success(true);
|
|
|
- }
|
|
|
-
|
|
|
- @DeleteMapping("/social-unbind")
|
|
|
- @ApiOperation("取消社交绑定")
|
|
|
- @PreAuthenticated
|
|
|
- public CommonResult<Boolean> socialUnbind(@RequestBody AppAuthSocialUnbindReqVO reqVO) {
|
|
|
- authService.unbindSocialUser(getLoginUserId(), reqVO);
|
|
|
- return CommonResult.success(true);
|
|
|
- }
|
|
|
-
|
|
|
}
|