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:
parent
cc84fdb20c
commit
456cac6b17
@ -69,7 +69,7 @@ const registerProps = [
|
|||||||
{name: 'password', type: 'string'},
|
{name: 'password', type: 'string'},
|
||||||
{name: 'invite', type: 'string'}];
|
{name: 'invite', type: 'string'}];
|
||||||
router.post('/register',
|
router.post('/register',
|
||||||
canonicalizeRequest, verifyBody(registerProps),
|
verifyBody(registerProps), canonicalizeRequest,
|
||||||
validateInvite, validateUsername,
|
validateInvite, validateUsername,
|
||||||
wrap(async (req, res, next) => {
|
wrap(async (req, res, next) => {
|
||||||
// Update the database
|
// Update the database
|
||||||
@ -87,7 +87,7 @@ router.post('/register',
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
const loginProps = [{name: 'username', type: 'string'}, {name: 'password', type: 'string'}];
|
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
|
// Authenticate
|
||||||
const user = await authenticate(req, res, next);
|
const user = await authenticate(req, res, next);
|
||||||
if (!user)
|
if (!user)
|
||||||
|
Loading…
Reference in New Issue
Block a user