diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-29 16:58:46 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-29 16:58:46 +0200 |
commit | be238a89b9e31986d33432dcc5b78924931b4148 (patch) | |
tree | e742551a32422e5c98be26812ecb2218d18b15b3 /api/src/routes/auth/register.ts | |
parent | fix util (diff) | |
download | server-be238a89b9e31986d33432dcc5b78924931b4148.tar.xz |
fix login register + message
Diffstat (limited to 'api/src/routes/auth/register.ts')
-rw-r--r-- | api/src/routes/auth/register.ts | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/api/src/routes/auth/register.ts b/api/src/routes/auth/register.ts index 5ad6d6a4..b0d8c9bd 100644 --- a/api/src/routes/auth/register.ts +++ b/api/src/routes/auth/register.ts @@ -1,5 +1,5 @@ import { Request, Response, Router } from "express"; -import { trimSpecial, User, Snowflake, Config } from "@fosscord/util"; +import { trimSpecial, User, Snowflake, Config, defaultSettings } from "@fosscord/util"; import bcrypt from "bcrypt"; import { check, Email, EMAIL_REGEX, FieldErrors, Length } from "../../util/instanceOf"; import "missing-native-js-functions"; @@ -182,17 +182,29 @@ router.post( // if nsfw_allowed is null/undefined it'll require date_of_birth to set it to true/false const user = await new User({ + created_at: new Date(), username: adjusted_username, discriminator, + bot: false, + system: false, + desktop: false, + mobile: false, premium: true, premium_type: 2, + bio: "", + mfa_enabled: false, + verified: false, + disabled: false, + deleted: false, email: adjusted_email, nsfw_allowed: true, // TODO: depending on age - guilds: [], + public_flags: "0", + flags: "0", // TODO: generate data: { hash: adjusted_password, valid_tokens_since: new Date() - } + }, + settings: defaultSettings }).save(); return res.json({ token: await generateToken(user.id) }); |