web/flows: don't autoclose in redirect stage if redirecting to non-http protocol (#5506)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens L 2023-05-07 12:58:14 +02:00 committed by GitHub
parent 080f2ab5e7
commit 395dc08f05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 25 deletions

View File

@ -1,37 +1,25 @@
import "@goauthentik/elements/EmptyState";
import "@goauthentik/flow/FormStatic";
import { AccessDeniedStage } from "@goauthentik/flow/stages/access_denied/AccessDeniedStage";
import { BaseStage } from "@goauthentik/flow/stages/base";
import { t } from "@lingui/macro";
import { TemplateResult, html } from "lit";
import { customElement } from "lit/decorators.js";
import { OAuthDeviceCodeFinishChallenge } from "@goauthentik/api";
@customElement("ak-flow-provider-oauth2-code-finish")
export class DeviceCodeFinish extends AccessDeniedStage {
export class DeviceCodeFinish extends BaseStage<
OAuthDeviceCodeFinishChallenge,
OAuthDeviceCodeFinishChallenge
> {
render(): TemplateResult {
if (!this.challenge) {
return html`<ak-empty-state ?loading="${true}" header=${t`Loading`}> </ak-empty-state>`;
}
return html`<header class="pf-c-login__main-header">
<h1 class="pf-c-title pf-m-3xl">${this.challenge.flowInfo?.title}</h1>
</header>
<div class="pf-c-login__main-body">
<form class="pf-c-form">
<div class="pf-c-form__group">
<p class="big-icon">
<i class="pf-icon pf-icon-ok"></i>
</p>
<h3 class="pf-c-title pf-m-3xl reason">
${t`You've successfully authenticated your device.`}
</h3>
<hr />
<p>${t`You can close this tab now.`}</p>
</div>
</form>
</div>
<footer class="pf-c-login__main-footer">
<ul class="pf-c-login__main-footer-links"></ul>
</footer>`;
return html`<ak-empty-state icon="fas fa-check" header=${t`You may close this page now.`}>
<span slot="body"> ${t`You've successfully authenticated your device.`} </span>
</ak-empty-state>`;
}
}

View File

@ -64,9 +64,6 @@ export class RedirectStage extends BaseStage<RedirectChallenge, FlowChallengeRes
// As this wouldn't really be a redirect, show a message that the page can be closed
// and try to close it ourselves
if (!url.protocol.startsWith("http")) {
setTimeout(() => {
window.close();
}, 500);
return html`<ak-empty-state
icon="fas fa-check"
header=${t`You may close this page now.`}