1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-11-10 15:48:27 -05:00

Verify the request before attempting to canonicalize it

This commit is contained in:
Jack Foltz 2018-07-29 10:57:27 -04:00
parent cc84fdb20c
commit 456cac6b17
Signed by: foltik
GPG Key ID: 303F88F996E95541

View File

@ -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)