fix login register + message
This commit is contained in:
parent
681ce2ac47
commit
be238a89b9
BIN
api/package-lock.json
generated
BIN
api/package-lock.json
generated
Binary file not shown.
@ -74,8 +74,8 @@
|
|||||||
"i18next-http-middleware": "^3.1.3",
|
"i18next-http-middleware": "^3.1.3",
|
||||||
"i18next-node-fs-backend": "^2.1.3",
|
"i18next-node-fs-backend": "^2.1.3",
|
||||||
"jsonwebtoken": "^8.5.1",
|
"jsonwebtoken": "^8.5.1",
|
||||||
"lambert-server": "^1.2.8",
|
"lambert-server": "^1.2.10",
|
||||||
"missing-native-js-functions": "^1.2.10",
|
"missing-native-js-functions": "^1.2.11",
|
||||||
"mongoose": "^5.12.3",
|
"mongoose": "^5.12.3",
|
||||||
"mongoose-autopopulate": "^0.12.3",
|
"mongoose-autopopulate": "^0.12.3",
|
||||||
"mongoose-long": "^0.3.2",
|
"mongoose-long": "^0.3.2",
|
||||||
|
|||||||
@ -21,7 +21,7 @@ router.post(
|
|||||||
async (req: Request, res: Response) => {
|
async (req: Request, res: Response) => {
|
||||||
const { login, password, captcha_key, undelete } = req.body;
|
const { login, password, captcha_key, undelete } = req.body;
|
||||||
const email = adjustEmail(login);
|
const email = adjustEmail(login);
|
||||||
console.log(req.body, email);
|
console.log("login", email);
|
||||||
|
|
||||||
const config = Config.get();
|
const config = Config.get();
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { Request, Response, Router } from "express";
|
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 bcrypt from "bcrypt";
|
||||||
import { check, Email, EMAIL_REGEX, FieldErrors, Length } from "../../util/instanceOf";
|
import { check, Email, EMAIL_REGEX, FieldErrors, Length } from "../../util/instanceOf";
|
||||||
import "missing-native-js-functions";
|
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
|
// if nsfw_allowed is null/undefined it'll require date_of_birth to set it to true/false
|
||||||
|
|
||||||
const user = await new User({
|
const user = await new User({
|
||||||
|
created_at: new Date(),
|
||||||
username: adjusted_username,
|
username: adjusted_username,
|
||||||
discriminator,
|
discriminator,
|
||||||
|
bot: false,
|
||||||
|
system: false,
|
||||||
|
desktop: false,
|
||||||
|
mobile: false,
|
||||||
premium: true,
|
premium: true,
|
||||||
premium_type: 2,
|
premium_type: 2,
|
||||||
|
bio: "",
|
||||||
|
mfa_enabled: false,
|
||||||
|
verified: false,
|
||||||
|
disabled: false,
|
||||||
|
deleted: false,
|
||||||
email: adjusted_email,
|
email: adjusted_email,
|
||||||
nsfw_allowed: true, // TODO: depending on age
|
nsfw_allowed: true, // TODO: depending on age
|
||||||
guilds: [],
|
public_flags: "0",
|
||||||
|
flags: "0", // TODO: generate
|
||||||
data: {
|
data: {
|
||||||
hash: adjusted_password,
|
hash: adjusted_password,
|
||||||
valid_tokens_since: new Date()
|
valid_tokens_since: new Date()
|
||||||
}
|
},
|
||||||
|
settings: defaultSettings
|
||||||
}).save();
|
}).save();
|
||||||
|
|
||||||
return res.json({ token: await generateToken(user.id) });
|
return res.json({ token: await generateToken(user.id) });
|
||||||
|
|||||||
@ -11,7 +11,7 @@ export const MessageCreateSchema = {
|
|||||||
$content: new Length(String, 0, 2000),
|
$content: new Length(String, 0, 2000),
|
||||||
$nonce: String,
|
$nonce: String,
|
||||||
$tts: Boolean,
|
$tts: Boolean,
|
||||||
$flags: BigInt,
|
$flags: String,
|
||||||
$embed: {
|
$embed: {
|
||||||
$title: new Length(String, 0, 256), //title of embed
|
$title: new Length(String, 0, 256), //title of embed
|
||||||
$type: String, // type of embed (always "rich" for webhook embeds)
|
$type: String, // type of embed (always "rich" for webhook embeds)
|
||||||
@ -69,7 +69,7 @@ export interface MessageCreateSchema {
|
|||||||
content?: string;
|
content?: string;
|
||||||
nonce?: string;
|
nonce?: string;
|
||||||
tts?: boolean;
|
tts?: boolean;
|
||||||
flags?: bigint;
|
flags?: string;
|
||||||
embed?: Embed & { timestamp?: string };
|
embed?: Embed & { timestamp?: string };
|
||||||
allowed_mentions?: {
|
allowed_mentions?: {
|
||||||
parse?: string[];
|
parse?: string[];
|
||||||
|
|||||||
Reference in New Issue
Block a user