Commit ff5acba3 authored by NGPixel's avatar NGPixel

fix: redirect to previous path after login

parent 1fc786e2
......@@ -294,7 +294,13 @@ export default {
this.loaderTitle = this.$t('auth:loginSuccess')
Cookies.set('jwt', respObj.jwt, { expires: 365 })
_.delay(() => {
window.location.replace('/') // TEMPORARY - USE RETURNURL
const loginRedirect = Cookies.get('loginRedirect')
if (loginRedirect) {
Cookies.remove('loginRedirect')
window.location.replace(loginRedirect)
} else {
window.location.replace('/')
}
}, 1000)
}
} else {
......
......@@ -245,6 +245,11 @@ router.get('/*', async (req, res, next) => {
pageArgs.tags = _.get(page, 'tags', [])
if (!WIKI.auth.checkAccess(req.user, ['read:pages'], pageArgs)) {
if (req.user.id === 2) {
res.cookie('loginRedirect', req.path, {
maxAge: 15 * 60 * 1000
})
}
if (pageArgs.path === 'home' && req.user.id === 2) {
return res.redirect('/login')
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment