From 456cac6b177059cd0ef8c751046cb9112a2b7881 Mon Sep 17 00:00:00 2001 From: Jack Foltz Date: Sun, 29 Jul 2018 10:57:27 -0400 Subject: [PATCH] Verify the request before attempting to canonicalize it --- app/routes/auth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/routes/auth.js b/app/routes/auth.js index a61af7f..923bd0d 100644 --- a/app/routes/auth.js +++ b/app/routes/auth.js @@ -69,7 +69,7 @@ const registerProps = [ {name: 'password', type: 'string'}, {name: 'invite', type: 'string'}]; router.post('/register', - canonicalizeRequest, verifyBody(registerProps), + verifyBody(registerProps), canonicalizeRequest, validateInvite, validateUsername, wrap(async (req, res, next) => { // Update the database @@ -87,7 +87,7 @@ router.post('/register', })); const loginProps = [{name: 'username', type: 'string'}, {name: 'password', type: 'string'}]; -router.post('/login', canonicalizeRequest, verifyBody(loginProps), wrap(async (req, res, next) => { +router.post('/login', verifyBody(loginProps), canonicalizeRequest, wrap(async (req, res, next) => { // Authenticate const user = await authenticate(req, res, next); if (!user)