web: fix redirect when accessing authentik URLs authenticated
closes #3174 Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
@ -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;
|
||||
});
|
||||
|
@ -100,6 +100,11 @@ export class AdminInterface extends LitElement {
|
||||
});
|
||||
});
|
||||
this.version = new AdminApi(DEFAULT_CONFIG).adminVersionRetrieve();
|
||||
me().then((u) => {
|
||||
if (!u.user.isSuperuser && u.user.pk > 0) {
|
||||
window.location.assign("/if/user");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
render(): TemplateResult {
|
||||
@ -150,11 +155,6 @@ export class AdminInterface extends LitElement {
|
||||
}
|
||||
|
||||
renderSidebarItems(): TemplateResult {
|
||||
me().then((u) => {
|
||||
if (!u.user.isSuperuser) {
|
||||
window.location.assign("/if/user");
|
||||
}
|
||||
});
|
||||
return html`
|
||||
${until(
|
||||
this.version.then((version) => {
|
||||
|
Reference in New Issue
Block a user