enhance(backend): usernameに対してもprohibitedWordsForNameOfUserを適用 (#16282)

* enhance(backend): usernameに対してもprohibitedWordsForNameOfUserを適用
Resolve #16281

* fix locales/index/d.ts
This commit is contained in:
tamaina 2025-07-15 09:32:46 +09:00 committed by GitHub
parent 08cc5a99bb
commit ad7bf096e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

2
locales/index.d.ts vendored
View File

@ -5231,7 +5231,7 @@ export interface Locale extends ILocale {
*/
"prohibitedWordsForNameOfUser": string;
/**
*
* (username)
*/
"prohibitedWordsForNameOfUserDescription": string;
/**

View File

@ -1303,7 +1303,7 @@ messageToFollower: "フォロワーへのメッセージ"
target: "対象"
testCaptchaWarning: "CAPTCHAのテストを目的とした機能です。<strong>本番環境で使用しないでください。</strong>"
prohibitedWordsForNameOfUser: "禁止ワード(ユーザーの名前)"
prohibitedWordsForNameOfUserDescription: "このリストに含まれる文字列がユーザーの名前に含まれる場合、ユーザーの名前の変更を拒否します。モデレーター権限を持つユーザーはこの制限の影響を受けません。"
prohibitedWordsForNameOfUserDescription: "このリストに含まれる文字列がユーザーの名前に含まれる場合、ユーザーの名前の変更を拒否します。モデレーター権限を持つユーザーはこの制限の影響を受けません。ユーザー名(username)に対しても全て小文字に置き換えて検査します。"
yourNameContainsProhibitedWords: "変更しようとした名前に禁止された文字列が含まれています"
yourNameContainsProhibitedWordsDescription: "名前に禁止されている文字列が含まれています。この名前を使用したい場合は、サーバー管理者にお問い合わせください。"
thisContentsAreMarkedAsSigninRequiredByAuthor: "投稿者により、表示にはログインが必要と設定されています"

View File

@ -93,6 +93,11 @@ export class SignupService {
if (isPreserved) {
throw new Error('USED_USERNAME');
}
const hasProhibitedWords = this.utilityService.isKeyWordIncluded(username.toLowerCase(), this.meta.prohibitedWordsForNameOfUser);
if (hasProhibitedWords) {
throw new Error('USED_USERNAME');
}
}
const keyPair = await new Promise<string[]>((res, rej) =>