web: fix redirect when accessing authentik URLs authenticated

closes #3174

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2022-06-30 22:37:29 +02:00
parent b7558ae28c
commit 56fd436e5d
4 changed files with 13 additions and 8 deletions

View File

@ -43,7 +43,10 @@ export function me(): Promise<SessionUser> {
},
};
if (ex.response.status === 401 || ex.response.status === 403) {
window.location.assign("/");
const relativeUrl = window.location
.toString()
.substring(window.location.origin.length);
window.location.assign(`/flows/-/default/authentication/?next=${encodeURIComponent(relativeUrl)}`);
}
return defaultUser;
});