特性:优化注册与改名卡逻辑,在触发敏感词或拦截重名时明确提示具体是触发了哪个词汇

This commit is contained in:
2026-04-02 16:38:17 +08:00
parent 63292ab810
commit c4edda8b4e
3 changed files with 45 additions and 26 deletions

View File

@@ -101,8 +101,13 @@ class AuthController extends Controller
}
// 检测用户名是否在禁用词列表(永久禁用 或 改名临时保留期内)
if (UsernameBlacklist::isBlocked($username)) {
return response()->json(['status' => 'error', 'message' => '该用户名已被系统禁止注册,请更换其他名称。'], 422);
if ($blockingRecord = UsernameBlacklist::getBlockingRecord($username)) {
$reason = '';
if ($blockingRecord->type === 'permanent') {
$reason = "(包含违禁敏感词:{$blockingRecord->username}";
}
return response()->json(['status' => 'error', 'message' => "该用户名已被系统禁止注册{$reason},请更换其他名称。"], 422);
}
// --- 提取邀请人 Cookie ---