summaryrefslogtreecommitdiff
path: root/src/server/api/private
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/api/private')
-rw-r--r--src/server/api/private/signup.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/server/api/private/signup.ts b/src/server/api/private/signup.ts
index ca197a6611..ac99ea0d33 100644
--- a/src/server/api/private/signup.ts
+++ b/src/server/api/private/signup.ts
@@ -104,6 +104,13 @@ export default async (ctx: Koa.BaseContext) => {
// Start transaction
await getConnection().transaction(async transactionalEntityManager => {
+ const exist = await transactionalEntityManager.findOne(User, {
+ usernameLower: username.toLowerCase(),
+ host: null
+ });
+
+ if (exist) throw 'already registered';
+
account = await transactionalEntityManager.save(new User({
id: genId(),
createdAt: new Date(),