From 29d682c4e81a4fbf4b058c770b64a7dd26588eb7 Mon Sep 17 00:00:00 2001 From: knighthawk4227 Date: Wed, 7 May 2025 19:26:00 -0700 Subject: [PATCH] fixing joi validation --- app.js | 6 +++--- src/views/resetPass.ejs | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app.js b/app.js index 17b3457..dd07121 100644 --- a/app.js +++ b/app.js @@ -110,10 +110,10 @@ app.get('/reset/:token', async (req, res) => { app.post('/resetLink', async (req, res) => { const { token, password, confirmPassword, } = req.body; const passwordSchema = joi.object({ - password: joi.string().max(20).min(6).required(), - confirmPassword: joi.string().max(20).min(6).required(), + password: joi.string().max(20).required(), + confirmPassword: joi.string().max(20).required(), }); - const valid = passwordSchema.validate(req.body); + const valid = passwordSchema.validate({ password, confirmPassword }); if (valid.error) { console.log("houston we have a problem"); req.session.error = 'Invalid input'; diff --git a/src/views/resetPass.ejs b/src/views/resetPass.ejs index d923d50..2673347 100644 --- a/src/views/resetPass.ejs +++ b/src/views/resetPass.ejs @@ -6,7 +6,7 @@

Reset Password


- +
- <% if (typeof errMessage !== 'undefined') { %> + <% if (typeof errMessage !=='undefined' ) { %>
<%= errMessage %>
- <% } %> -
- -
+ <% } %> +
+ +
-<%- include("./partials/footer") %> + <%- include("./partials/footer") %>