Merge pull request #909 from Linindoo/main

修复纯数字用户名的用户个人首页 404 问题(注册和修改校验用户名不能为纯数字)
This commit is contained in:
Tim
2025-09-07 11:14:40 +08:00
committed by GitHub

View File

@@ -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");
}
}
}