[UI] Redirect URIs should always be relative to the current host.

This commit is contained in:
Fabio Manganiello 2024-07-22 21:48:07 +02:00
parent fe2497577d
commit 8904e40f9f
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -42,18 +42,18 @@ export default {
// No users present -> redirect to the registration page
if (
error?.response?.data?.code === 412 &&
window.location.href.indexOf('/register') < 0
window.location.pathname !== '/register'
) {
window.location.href = '/register?redirect=' + window.location.href
window.location.href = '/register?redirect=' + window.location.href.split('/').slice(3).join('/')
return
}
// Unauthorized -> redirect to the login page
if (
error?.response?.data?.code === 401 &&
window.location.href.indexOf('/login') < 0
window.location.pathname !== '/login'
) {
window.location.href = '/login?redirect=' + window.location.href
window.location.href = '/login?redirect=' + window.location.href.split('/').slice(3).join('/')
return
}