From 2bdd6ab7226a69fcce80a9176c43506976573cab Mon Sep 17 00:00:00 2001 From: holabayor Date: Sat, 23 Sep 2023 10:33:17 +0100 Subject: [PATCH] lint fix --- controllers/authController.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/controllers/authController.js b/controllers/authController.js index af68f21b..3ff300c1 100644 --- a/controllers/authController.js +++ b/controllers/authController.js @@ -5,20 +5,21 @@ const User = require('../models/user.model'); const { createCustomError } = require('../errors/custom-errors'); const Organization = require('../models/organization.model'); const OrgLunchWallet = require('../models/org_lunch_wallet.model'); -const {sendEmail} = require('./mailController') +const { sendEmail } = require('./mailController'); + const secretKey = process.env.JWT_SECRET_KEY; async function validateEmail(req, res, next) { try { - const email = req.body.email; + const { email } = req.body; const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; - + if (!emailRegex.test(email)) { throw createCustomError('Invalid email format', 400); } await sendEmail(email); - + next(); } catch (error) { console.error(`Error sending email: ${error.message}`); @@ -26,8 +27,6 @@ async function validateEmail(req, res, next) { } } - - async function createUser(req, res, next) { try { const { @@ -231,4 +230,10 @@ async function createOrgAndUser(req, res, next) { } } -module.exports = { validateEmail, createUser, loginUser, logoutUser, createOrgAndUser }; +module.exports = { + validateEmail, + createUser, + loginUser, + logoutUser, + createOrgAndUser, +};