prevent potential redirect loop with activation link
This commit is contained in:
parent
1e027c4b88
commit
b0a6856fbc
@ -737,11 +737,14 @@ router.get('/logout', (req, res) => {
|
||||
router.get('/activate/:token', wrap(async (req, res) => {
|
||||
if (req.session.user) return res.redirect('/login')
|
||||
let token = req.params.token
|
||||
|
||||
let success = await API.User.Login.activationToken(token)
|
||||
if (!success) return formError(req, res, 'Unknown or invalid activation token')
|
||||
|
||||
if (!success) {
|
||||
req.flash('message', {error: true, text: 'Invalid or expired activation token.'})
|
||||
} else {
|
||||
req.flash('message', {error: false, text: 'Your account has been activated! You may now log in.'})
|
||||
}
|
||||
|
||||
res.redirect('/login')
|
||||
}))
|
||||
|
||||
|
Reference in New Issue
Block a user