From b3ec47c3f479c842a33074c13323597484d0d0b6 Mon Sep 17 00:00:00 2001 From: tamaina Date: Tue, 2 May 2023 10:18:57 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E6=9C=9F=E3=83=A6=E3=83=BC=E3=82=B6?= =?UTF-8?q?=E3=83=BC=E7=99=BB=E9=8C=B2=E6=99=82=E3=81=AB=E3=81=AFpreserved?= =?UTF-8?q?Usernames=E3=82=92=E7=84=A1=E8=A6=96=E3=81=99=E3=82=8B=20Fix=20?= =?UTF-8?q?#10738?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/backend/src/server/api/SignupApiService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/server/api/SignupApiService.ts b/packages/backend/src/server/api/SignupApiService.ts index f44e71771c..f3a1d406ae 100644 --- a/packages/backend/src/server/api/SignupApiService.ts +++ b/packages/backend/src/server/api/SignupApiService.ts @@ -139,7 +139,7 @@ export class SignupApiService { const isPreserved = instance.preservedUsernames.map(x => x.toLowerCase()).includes(username.toLowerCase()); if (isPreserved) { - throw new FastifyReplyError(400, 'USED_USERNAME'); + throw new FastifyReplyError(400, 'DENIED_USERNAME'); } const code = rndstr('a-z0-9', 16); @@ -169,6 +169,7 @@ export class SignupApiService { try { const { account, secret } = await this.signupService.signup({ username, password, host, + ignorePreservedUsernames: (await this.usersRepository.countBy({ host: IsNull() })) === 0, }); const res = await this.userEntityService.pack(account, account, {