Skip to content

Commit c0633a8

Browse files
authored
Merge pull request #4039 from nextcloud/fix/handle-invalid-token
reroute user to notfound or login page
2 parents aa77730 + 7b235f4 commit c0633a8

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/router.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,21 @@ const router = createRouter({
184184
router.beforeEach(async (to: RouteLocationNormalized) => {
185185
const sessionStore = useSessionStore()
186186
const pollStore = usePollStore()
187+
187188
try {
188189
await loadContext(to)
189190
} catch (error) {
190191
Logger.error('Could not load context')
191-
return false
192+
193+
if (!sessionStore.userStatus.isLoggedin) {
194+
// if the user is not logged in, redirect to the login page
195+
window.location.replace(generateUrl('login'))
196+
return false
197+
}
198+
199+
return {
200+
name: 'notfound',
201+
}
192202
}
193203

194204
try {

0 commit comments

Comments
 (0)