Refactor email sending + remove email verification if mail sending is not set up
This commit is contained in:
@@ -18,14 +18,13 @@
|
||||
|
||||
import { getIpAdress, route, verifyCaptcha } from "@spacebar/api";
|
||||
import {
|
||||
adjustEmail,
|
||||
Config,
|
||||
FieldErrors,
|
||||
generateToken,
|
||||
generateWebAuthnTicket,
|
||||
LoginSchema,
|
||||
User,
|
||||
WebAuthn,
|
||||
generateToken,
|
||||
generateWebAuthnTicket,
|
||||
} from "@spacebar/util";
|
||||
import bcrypt from "bcrypt";
|
||||
import crypto from "crypto";
|
||||
@@ -50,7 +49,6 @@ router.post(
|
||||
async (req: Request, res: Response) => {
|
||||
const { login, password, captcha_key, undelete } =
|
||||
req.body as LoginSchema;
|
||||
const email = adjustEmail(login);
|
||||
|
||||
const config = Config.get();
|
||||
|
||||
@@ -76,7 +74,7 @@ router.post(
|
||||
}
|
||||
|
||||
const user = await User.findOneOrFail({
|
||||
where: [{ phone: login }, { email: email }],
|
||||
where: [{ phone: login }, { email: login }],
|
||||
select: [
|
||||
"data",
|
||||
"id",
|
||||
|
||||
@@ -30,7 +30,6 @@ import {
|
||||
RegisterSchema,
|
||||
User,
|
||||
ValidRegistrationToken,
|
||||
adjustEmail,
|
||||
generateToken,
|
||||
} from "@spacebar/util";
|
||||
import bcrypt from "bcrypt";
|
||||
@@ -76,9 +75,6 @@ router.post(
|
||||
}
|
||||
}
|
||||
|
||||
// email will be slightly modified version of the user supplied email -> e.g. protection against GMail Trick
|
||||
const email = adjustEmail(body.email);
|
||||
|
||||
// check if registration is allowed
|
||||
if (!regTokenUsed && !register.allowNewRegistration) {
|
||||
throw FieldErrors({
|
||||
@@ -161,6 +157,7 @@ router.post(
|
||||
// TODO: gift_code_sku_id?
|
||||
// TODO: check password strength
|
||||
|
||||
const email = body.email;
|
||||
if (email) {
|
||||
// replace all dots and chars after +, if its a gmail.com email
|
||||
if (!email) {
|
||||
|
||||
Reference in New Issue
Block a user