Skip to content

Commit

Permalink
chore(middleware): added correct status code for auth redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Apr 29, 2019
1 parent bd949b7 commit 413d06a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/middleware/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,19 @@ middleware.redirectToLogin = function (req, res, next) {
req.session.redirectUrl = req.url
}

return res.redirect('/')
return res.redirect(401, '/')
}

if (req.user.deleted) {
req.logout()
req.session.l2auth = null
req.session.destroy()
return res.redirect('/')
return res.redirect(401, '/')
}

if (req.user.hasL2Auth) {
if (req.session.l2auth !== 'totp') {
return res.redirect('/')
return res.redirect(401, '/')
}
}

Expand Down

0 comments on commit 413d06a

Please sign in to comment.