From 9953f7ae3b5afdef93d1cdc8514085e356d470bd Mon Sep 17 00:00:00 2001 From: heminjian502 Date: Fri, 19 Aug 2022 15:35:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8C=BB=E7=94=9F=E5=BE=AE=E4=BF=A1=E7=99=BB?= =?UTF-8?q?=E5=BD=95=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/web/controller/system/SysLoginController.java | 5 +++++ 1 file changed, 5 insertions(+) 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()); }