Components for user modification, email validation

This commit is contained in:
oitsjustjose 2022-04-14 21:03:37 -05:00
commit 99a3d7ff33
9 changed files with 193 additions and 3 deletions

View file

@ -1,5 +1,6 @@
import EmailValidator from "email-validator";
import { Request, Response } from "express";
import Validate from "../../../email/templates/Validate";
import Users from "../../../models/User";
import { LOGGER } from "../../../util/Logger";
@ -36,6 +37,9 @@ export default async (req: Request, res: Response) => {
const created = new Users({ first, last, email: fmtEmail });
created.password = created.hashPassword(password);
await created.save();
await Validate(created);
return res.status(200).json(created);
} catch (ex) {
LOGGER.error(ex);