fixing joi validation
This commit is contained in:
1 parent
15dd4e0d20
commit
29d682c4e8
2 files changed
+5
-5
No files matched your search
@@ -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';
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
<% } %>
|
||||
<div class="mt-5">
|
||||
<button type="submit"
|
||||
class="cursor-pointer border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Send
|
||||
reset Link</button>
|
||||
class="cursor-pointer border-2 border-gray-600 bg-blue-600 text-white py-1 w-full rounded-md hover:bg-transparent hover:text-indigo-700 font-semibold">Change
|
||||
Password</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in new issue
Block a user