summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/SignupApiService.ts
diff options
context:
space:
mode:
authortamaina <tamaina@hotmail.co.jp>2023-05-02 10:18:57 +0000
committertamaina <tamaina@hotmail.co.jp>2023-05-02 10:18:57 +0000
commitb3ec47c3f479c842a33074c13323597484d0d0b6 (patch)
treea9b6c425655614434915f3c38cde31e441ed20b0 /packages/backend/src/server/api/SignupApiService.ts
parentUpdate CHANGELOG.md (diff)
downloadsharkey-b3ec47c3f479c842a33074c13323597484d0d0b6.tar.gz
sharkey-b3ec47c3f479c842a33074c13323597484d0d0b6.tar.bz2
sharkey-b3ec47c3f479c842a33074c13323597484d0d0b6.zip
初期ユーザー登録時にはpreservedUsernamesを無視する
Fix #10738
Diffstat (limited to 'packages/backend/src/server/api/SignupApiService.ts')
-rw-r--r--packages/backend/src/server/api/SignupApiService.ts3
1 files changed, 2 insertions, 1 deletions
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, {