refactor: 手机短信验证码认证代码优化和注释调整。

This commit is contained in:
Ray.Hao
2025-01-13 23:41:33 +08:00
parent 91c1b29f02
commit 025a70b0cd
6 changed files with 22 additions and 20 deletions

View File

@@ -75,7 +75,7 @@ public class AuthController {
@Operation(summary = "发送登录短信验证码")
@PostMapping("/login/sms/code")
public Result<?> sendLoginVerifyCode(
public Result<Void> sendLoginVerifyCode(
@Parameter(description = "手机号", example = "18812345678") @RequestParam String mobile
) {
authService.sendSmsLoginCode(mobile);
@@ -87,7 +87,7 @@ public class AuthController {
@Log(value = "短信验证码登录", module = LogModuleEnum.LOGIN)
public Result<AuthenticationToken> loginBySms(
@Parameter(description = "手机号", example = "18812345678") @RequestParam String mobile,
@Parameter(description = "验证码", example = "123456") @RequestParam String code
@Parameter(description = "验证码", example = "1234") @RequestParam String code
) {
AuthenticationToken loginResult = authService.loginBySms(mobile, code);
return Result.success(loginResult);

View File

@@ -53,7 +53,6 @@ public class AuthServiceImpl implements AuthService {
private final CodeGenerator codeGenerator;
private final SmsService smsService;
private final RedisTemplate<String, Object> redisTemplate;
/**
@@ -101,7 +100,7 @@ public class AuthServiceImpl implements AuthService {
}
/**
* 发送短信验证码
* 发送登录短信验证码
*
* @param mobile 手机号
*/
@@ -134,7 +133,7 @@ public class AuthServiceImpl implements AuthService {
*/
@Override
public AuthenticationToken loginBySms(String mobile, String code) {
// 1. 创建用户微信认证的令牌(未认证)
// 1. 创建用户短信验证码认证的令牌(未认证)
SmsAuthenticationToken smsAuthenticationToken = new SmsAuthenticationToken(mobile, code);
// 2. 执行认证(认证中)