|
@@ -1,10 +1,10 @@
|
|
|
-package cn.iocoder.yudao.userserver.modules.system.controller.auth;
|
|
|
+package cn.iocoder.yudao.module.member.controller.app.auth;
|
|
|
|
|
|
import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService;
|
|
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
|
|
-import cn.iocoder.yudao.userserver.modules.system.controller.auth.vo.*;
|
|
|
+import cn.iocoder.yudao.module.member.controller.app.auth.vo.*;
|
|
|
import cn.iocoder.yudao.userserver.modules.system.service.auth.SysAuthService;
|
|
|
import cn.iocoder.yudao.userserver.modules.system.service.sms.SysSmsCodeService;
|
|
|
import io.swagger.annotations.Api;
|
|
@@ -23,12 +23,12 @@ import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getCli
|
|
|
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getUserAgent;
|
|
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
|
|
|
|
-@Api(tags = "认证")
|
|
|
+@Api(tags = "APP 端 - 认证")
|
|
|
@RestController
|
|
|
@RequestMapping("/")
|
|
|
@Validated
|
|
|
@Slf4j
|
|
|
-public class SysAuthController {
|
|
|
+public class AppAuthController {
|
|
|
|
|
|
@Resource
|
|
|
private SysAuthService authService;
|
|
@@ -39,18 +39,18 @@ public class SysAuthController {
|
|
|
|
|
|
@PostMapping("/login")
|
|
|
@ApiOperation("使用手机 + 密码登录")
|
|
|
- public CommonResult<SysAuthLoginRespVO> login(@RequestBody @Valid SysAuthLoginReqVO reqVO) {
|
|
|
+ public CommonResult<AppAuthLoginRespVO> login(@RequestBody @Valid AppAuthLoginReqVO reqVO) {
|
|
|
String token = authService.login(reqVO, getClientIP(), getUserAgent());
|
|
|
// 返回结果
|
|
|
- return success(SysAuthLoginRespVO.builder().token(token).build());
|
|
|
+ return success(AppAuthLoginRespVO.builder().token(token).build());
|
|
|
}
|
|
|
|
|
|
@PostMapping("/sms-login")
|
|
|
@ApiOperation("使用手机 + 验证码登录")
|
|
|
- public CommonResult<SysAuthLoginRespVO> smsLogin(@RequestBody @Valid SysAuthSmsLoginReqVO reqVO) {
|
|
|
+ public CommonResult<AppAuthLoginRespVO> smsLogin(@RequestBody @Valid AppAuthSmsLoginReqVO reqVO) {
|
|
|
String token = authService.smsLogin(reqVO, getClientIP(), getUserAgent());
|
|
|
// 返回结果
|
|
|
- return success(SysAuthLoginRespVO.builder().token(token).build());
|
|
|
+ return success(AppAuthLoginRespVO.builder().token(token).build());
|
|
|
}
|
|
|
|
|
|
@PostMapping("/send-sms-code")
|
|
@@ -70,7 +70,7 @@ public class SysAuthController {
|
|
|
@PostMapping("/reset-password")
|
|
|
@ApiOperation(value = "重置密码", notes = "用户忘记密码时使用")
|
|
|
@PreAuthenticated
|
|
|
- public CommonResult<Boolean> resetPassword(@RequestBody @Valid MbrAuthResetPasswordReqVO reqVO) {
|
|
|
+ public CommonResult<Boolean> resetPassword(@RequestBody @Valid AppAuthResetPasswordReqVO reqVO) {
|
|
|
authService.resetPassword(reqVO);
|
|
|
return success(true);
|
|
|
}
|
|
@@ -78,12 +78,11 @@ public class SysAuthController {
|
|
|
@PostMapping("/update-password")
|
|
|
@ApiOperation(value = "修改用户密码",notes = "用户修改密码时使用")
|
|
|
@PreAuthenticated
|
|
|
- public CommonResult<Boolean> updatePassword(@RequestBody @Valid MbrAuthUpdatePasswordReqVO reqVO) {
|
|
|
+ public CommonResult<Boolean> updatePassword(@RequestBody @Valid AppAuthUpdatePasswordReqVO reqVO) {
|
|
|
authService.updatePassword(getLoginUserId(), reqVO);
|
|
|
return success(true);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// ========== 社交登录相关 ==========
|
|
|
|
|
|
@GetMapping("/social-auth-redirect")
|
|
@@ -97,32 +96,30 @@ public class SysAuthController {
|
|
|
return CommonResult.success(socialService.getAuthorizeUrl(type, redirectUri));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@PostMapping("/social-login")
|
|
|
@ApiOperation("社交登录,使用 code 授权码")
|
|
|
- public CommonResult<SysAuthLoginRespVO> socialLogin(@RequestBody @Valid MbrAuthSocialLoginReqVO reqVO) {
|
|
|
+ public CommonResult<AppAuthLoginRespVO> socialLogin(@RequestBody @Valid AppAuthSocialLoginReqVO reqVO) {
|
|
|
String token = authService.socialLogin(reqVO, getClientIP(), getUserAgent());
|
|
|
- return success(SysAuthLoginRespVO.builder().token(token).build());
|
|
|
+ return success(AppAuthLoginRespVO.builder().token(token).build());
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@PostMapping("/social-login2")
|
|
|
@ApiOperation("社交登录,使用 手机号 + 手机验证码")
|
|
|
- public CommonResult<SysAuthLoginRespVO> socialLogin2(@RequestBody @Valid MbrAuthSocialLogin2ReqVO reqVO) {
|
|
|
+ public CommonResult<AppAuthLoginRespVO> socialLogin2(@RequestBody @Valid AppAuthSocialLogin2ReqVO reqVO) {
|
|
|
String token = authService.socialLogin2(reqVO, getClientIP(), getUserAgent());
|
|
|
- return success(SysAuthLoginRespVO.builder().token(token).build());
|
|
|
+ return success(AppAuthLoginRespVO.builder().token(token).build());
|
|
|
}
|
|
|
|
|
|
@PostMapping("/social-bind")
|
|
|
@ApiOperation("社交绑定,使用 code 授权码")
|
|
|
- public CommonResult<Boolean> socialBind(@RequestBody @Valid MbrAuthSocialBindReqVO reqVO) {
|
|
|
+ public CommonResult<Boolean> socialBind(@RequestBody @Valid AppAuthSocialBindReqVO reqVO) {
|
|
|
authService.socialBind(getLoginUserId(), reqVO);
|
|
|
return CommonResult.success(true);
|
|
|
}
|
|
|
|
|
|
@DeleteMapping("/social-unbind")
|
|
|
@ApiOperation("取消社交绑定")
|
|
|
- public CommonResult<Boolean> socialUnbind(@RequestBody MbrAuthSocialUnbindReqVO reqVO) {
|
|
|
+ public CommonResult<Boolean> socialUnbind(@RequestBody AppAuthSocialUnbindReqVO reqVO) {
|
|
|
socialService.unbindSocialUser(getLoginUserId(), reqVO.getType(), reqVO.getUnionId(), UserTypeEnum.MEMBER);
|
|
|
return CommonResult.success(true);
|
|
|
}
|