diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index 9b3e7a6..c720c6c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -3,6 +3,7 @@ package com.ruoyi.web.controller.system; import java.util.List; import java.util.Objects; import java.util.Set; +import java.util.regex.Pattern; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.system.domain.req.AppRegisterReq; @@ -75,6 +76,10 @@ public class SysLoginController @PostMapping("/login/app") public AjaxResult loginForApp(@RequestBody LoginBody loginBody) { logger.info("login for app :{}", loginBody.getUsername()); + String regexp = "1[3|4|5|6|7|8|9][0-9]\\d{8}"; + if (!Pattern.matches(regexp, loginBody.getUsername())) { + return AjaxResult.error("手机号码校验错误"); + } return loginService.loginForApp(loginBody.getUsername(), loginBody.getPassword()); }