From 55adb8efa96bb0a8b8ce3ae3851ac5e478d2f67a Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 10 Jul 2022 00:02:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=96=87=E4=BB=B6=E7=9A=84?= =?UTF-8?q?=20type=20=E8=AF=86=E5=88=AB=E4=B8=8E=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/auth/vo/AuthSmsLoginReqVO.java | 19 +++++-------------- .../service/auth/AdminAuthServiceImpl.java | 2 +- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthSmsLoginReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthSmsLoginReqVO.java index 5e4135546..b641bcca6 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthSmsLoginReqVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/AuthSmsLoginReqVO.java @@ -1,17 +1,16 @@ package cn.iocoder.yudao.module.system.controller.admin.auth.vo; +import cn.iocoder.yudao.framework.common.validation.Mobile; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.Pattern; -@ApiModel("管理后台 - 短信验证码的呢老姑 Request VO") +@ApiModel("管理后台 - 短信验证码的登录 Request VO") @Data @NoArgsConstructor @AllArgsConstructor @@ -20,19 +19,11 @@ public class AuthSmsLoginReqVO { @ApiModelProperty(value = "手机号", required = true, example = "yudaoyuanma") @NotEmpty(message = "手机号不能为空") - @Length(min = 11, max = 11, message = "手机号格式错误,仅支持大陆手机号") - @Pattern(regexp = "^[1](([3][0-9])|([4][5-9])|([5][0-3,5-9])|([6][5,6])|([7][0-8])|([8][0-9])|([9][1,8,9]))[0-9]{8}$", message = "账号格式为数字以及字母") + @Mobile private String mobile; - - - @ApiModelProperty(value = "短信验证码", required = true, example = "1024", notes = "验证码开启时,需要传递") - @NotEmpty(message = "验证码不能为空", groups = CodeEnableGroup.class) + @ApiModelProperty(value = "短信验证码", required = true, example = "1024") + @NotEmpty(message = "验证码不能为空") private String code; - /** - * 开启验证码的 Group - */ - public interface CodeEnableGroup {} - } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java index 99e0ff1e6..8f54e9f61 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/auth/AdminAuthServiceImpl.java @@ -123,7 +123,7 @@ public class AdminAuthServiceImpl implements AdminAuthService { throw exception(USER_NOT_EXISTS); } - // 缓存登陆用户到 Redis 中,返回 sessionId 编号 + // 创建 Token 令牌,记录登录日志 return createTokenAfterLoginSuccess(user.getId(), reqVO.getMobile(), LoginLogTypeEnum.LOGIN_MOBILE); }