mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-06 23:21:16 +08:00
Merge pull request #909 from Linindoo/main
修复纯数字用户名的用户个人首页 404 问题(注册和修改校验用户名不能为纯数字)
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user