From 5534573a19cf478a2e6b4f9b5fd742f03e234590 Mon Sep 17 00:00:00 2001 From: zhoujia Date: Fri, 5 Sep 2025 15:08:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=92=8C=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=90=8D=E6=A0=A1=E9=AA=8C=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=EF=BC=8C=E4=B8=8D=E5=85=81=E8=AE=B8=E7=BA=AF?= =?UTF-8?q?=E6=95=B0=E5=AD=97=E7=94=A8=E6=88=B7=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/openisle/service/UsernameValidator.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/src/main/java/com/openisle/service/UsernameValidator.java b/backend/src/main/java/com/openisle/service/UsernameValidator.java index 70fda0a1f..394b1562b 100644 --- a/backend/src/main/java/com/openisle/service/UsernameValidator.java +++ b/backend/src/main/java/com/openisle/service/UsernameValidator.java @@ -1,6 +1,7 @@ package com.openisle.service; import com.openisle.exception.FieldException; +import org.apache.commons.lang3.math.NumberUtils; import org.springframework.stereotype.Service; /** @@ -17,6 +18,11 @@ public class UsernameValidator { if (username == null || username.isEmpty()) { throw new FieldException("username", "Username cannot be empty"); } + + if (NumberUtils.isDigits(username)) { + throw new FieldException("username", "Username cannot be pure number"); + } } + }