1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-13 06:02:39 +01:00

Update: Update fosscord-server-util to latest and fix issues with NULL and undefined

This commit is contained in:
Diego Magdaleno 2021-05-23 12:44:02 -05:00
parent dc32c39af3
commit 55cf3b4b02
3 changed files with 11 additions and 11 deletions

14
package-lock.json generated
View File

@ -9,7 +9,7 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@fosscord/server-util": "^1.2.8", "@fosscord/server-util": "^1.3.0",
"@types/jest": "^26.0.22", "@types/jest": "^26.0.22",
"@types/json-schema": "^7.0.7", "@types/json-schema": "^7.0.7",
"ajv": "^8.4.0", "ajv": "^8.4.0",
@ -498,9 +498,9 @@
} }
}, },
"node_modules/@fosscord/server-util": { "node_modules/@fosscord/server-util": {
"version": "1.2.8", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.2.8.tgz", "resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.3.0.tgz",
"integrity": "sha512-akw6J6E+XxMn+diBRQbXn49QDkE3okgX5qEr0UjzRjaw/eE5+OieE/y9f9v8VhBQYYkNWFrdRt23QBRREQuqUg==", "integrity": "sha512-GBU1XLAQKylr76Vb5kGEkYInj0qPkz/D9oAVSPISMIWbYeo6RIfARVneg6FdreWC+WK7UNcpGr+JFJpvMfSeOA==",
"dependencies": { "dependencies": {
"@types/jsonwebtoken": "^8.5.0", "@types/jsonwebtoken": "^8.5.0",
"@types/mongoose-autopopulate": "^0.10.1", "@types/mongoose-autopopulate": "^0.10.1",
@ -12664,9 +12664,9 @@
} }
}, },
"@fosscord/server-util": { "@fosscord/server-util": {
"version": "1.2.8", "version": "1.3.0",
"resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.2.8.tgz", "resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.3.0.tgz",
"integrity": "sha512-akw6J6E+XxMn+diBRQbXn49QDkE3okgX5qEr0UjzRjaw/eE5+OieE/y9f9v8VhBQYYkNWFrdRt23QBRREQuqUg==", "integrity": "sha512-GBU1XLAQKylr76Vb5kGEkYInj0qPkz/D9oAVSPISMIWbYeo6RIfARVneg6FdreWC+WK7UNcpGr+JFJpvMfSeOA==",
"requires": { "requires": {
"@types/jsonwebtoken": "^8.5.0", "@types/jsonwebtoken": "^8.5.0",
"@types/mongoose-autopopulate": "^0.10.1", "@types/mongoose-autopopulate": "^0.10.1",

View File

@ -29,7 +29,7 @@
}, },
"homepage": "https://github.com/fosscord/fosscord-api#readme", "homepage": "https://github.com/fosscord/fosscord-api#readme",
"dependencies": { "dependencies": {
"@fosscord/server-util": "^1.2.8", "@fosscord/server-util": "^1.3.0",
"@types/jest": "^26.0.22", "@types/jest": "^26.0.22",
"@types/json-schema": "^7.0.7", "@types/json-schema": "^7.0.7",
"ajv": "^8.4.0", "ajv": "^8.4.0",

View File

@ -40,7 +40,7 @@ router.post(
// TODO: check password strength // TODO: check password strength
// adjusted_email will be slightly modified version of the user supplied email -> e.g. protection against GMail Trick // adjusted_email will be slightly modified version of the user supplied email -> e.g. protection against GMail Trick
let adjusted_email: string | undefined = adjustEmail(email); let adjusted_email: string | null = adjustEmail(email);
// adjusted_password will be the hash of the password // adjusted_password will be the hash of the password
let adjusted_password: string = ""; let adjusted_password: string = "";
@ -181,7 +181,7 @@ router.post(
mobile: false, mobile: false,
premium: false, premium: false,
premium_type: 0, premium_type: 0,
phone: undefined, phone: null,
mfa_enabled: false, mfa_enabled: false,
verified: false, verified: false,
presence: { presence: {
@ -253,7 +253,7 @@ router.post(
} }
); );
export function adjustEmail(email: string): string | undefined { export function adjustEmail(email: string): string | null {
// body parser already checked if it is a valid email // body parser already checked if it is a valid email
const parts = <RegExpMatchArray>email.match(EMAIL_REGEX); const parts = <RegExpMatchArray>email.match(EMAIL_REGEX);
// @ts-ignore // @ts-ignore