初期ユーザー登録時にはpreservedUsernamesを無視する

Fix #10738
This commit is contained in:
tamaina 2023-05-02 10:18:57 +00:00
parent a2e475f2e8
commit b3ec47c3f4
1 changed files with 2 additions and 1 deletions

View File

@ -139,7 +139,7 @@ export class SignupApiService {
const isPreserved = instance.preservedUsernames.map(x => x.toLowerCase()).includes(username.toLowerCase()); const isPreserved = instance.preservedUsernames.map(x => x.toLowerCase()).includes(username.toLowerCase());
if (isPreserved) { if (isPreserved) {
throw new FastifyReplyError(400, 'USED_USERNAME'); throw new FastifyReplyError(400, 'DENIED_USERNAME');
} }
const code = rndstr('a-z0-9', 16); const code = rndstr('a-z0-9', 16);
@ -169,6 +169,7 @@ export class SignupApiService {
try { try {
const { account, secret } = await this.signupService.signup({ const { account, secret } = await this.signupService.signup({
username, password, host, username, password, host,
ignorePreservedUsernames: (await this.usersRepository.countBy({ host: IsNull() })) === 0,
}); });
const res = await this.userEntityService.pack(account, account, { const res = await this.userEntityService.pack(account, account, {