web/flows: also check for redirects as result of posting challenge
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
8acb15a7fd
commit
3323b50036
|
@ -96,6 +96,16 @@ export class FlowExecutor extends LitElement implements StageHost {
|
|||
}
|
||||
|
||||
private postUpdate(): void {
|
||||
// Assign the location as soon as we get the challenge and *not* in the render function
|
||||
// as the render function might be called multiple times, which will navigate multiple
|
||||
// times and can invalidate oauth codes
|
||||
if (this.challenge?.type === ChallengeChoices.Redirect) {
|
||||
console.debug(
|
||||
"authentik/flows: redirecting to url from server",
|
||||
(this.challenge as RedirectChallenge).to,
|
||||
);
|
||||
window.location.assign((this.challenge as RedirectChallenge).to);
|
||||
}
|
||||
tenant().then((tenant) => {
|
||||
if (this.challenge?.flowInfo?.title) {
|
||||
document.title = `${this.challenge.flowInfo?.title} - ${tenant.brandingTitle}`;
|
||||
|
@ -120,16 +130,6 @@ export class FlowExecutor extends LitElement implements StageHost {
|
|||
.then((data) => {
|
||||
this.challenge = data;
|
||||
this.postUpdate();
|
||||
// Assign the location as soon as we get the challenge and *not* in the render function
|
||||
// as the render function might be called multiple times, which will navigate multiple
|
||||
// times and can invalidate oauth codes
|
||||
if (this.challenge.type === ChallengeChoices.Redirect) {
|
||||
console.debug(
|
||||
"authentik/flows: redirecting to url from server",
|
||||
(this.challenge as RedirectChallenge).to,
|
||||
);
|
||||
window.location.assign((this.challenge as RedirectChallenge).to);
|
||||
}
|
||||
})
|
||||
.catch((e: Error | Response) => {
|
||||
this.errorMessage(e);
|
||||
|
|
Reference in a new issue