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:
parent
080f2ab5e7
commit
395dc08f05
|
@ -1,37 +1,25 @@
|
||||||
import "@goauthentik/elements/EmptyState";
|
import "@goauthentik/elements/EmptyState";
|
||||||
import "@goauthentik/flow/FormStatic";
|
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 { t } from "@lingui/macro";
|
||||||
|
|
||||||
import { TemplateResult, html } from "lit";
|
import { TemplateResult, html } from "lit";
|
||||||
import { customElement } from "lit/decorators.js";
|
import { customElement } from "lit/decorators.js";
|
||||||
|
|
||||||
|
import { OAuthDeviceCodeFinishChallenge } from "@goauthentik/api";
|
||||||
|
|
||||||
@customElement("ak-flow-provider-oauth2-code-finish")
|
@customElement("ak-flow-provider-oauth2-code-finish")
|
||||||
export class DeviceCodeFinish extends AccessDeniedStage {
|
export class DeviceCodeFinish extends BaseStage<
|
||||||
|
OAuthDeviceCodeFinishChallenge,
|
||||||
|
OAuthDeviceCodeFinishChallenge
|
||||||
|
> {
|
||||||
render(): TemplateResult {
|
render(): TemplateResult {
|
||||||
if (!this.challenge) {
|
if (!this.challenge) {
|
||||||
return html`<ak-empty-state ?loading="${true}" header=${t`Loading`}> </ak-empty-state>`;
|
return html`<ak-empty-state ?loading="${true}" header=${t`Loading`}> </ak-empty-state>`;
|
||||||
}
|
}
|
||||||
return html`<header class="pf-c-login__main-header">
|
return html`<ak-empty-state icon="fas fa-check" header=${t`You may close this page now.`}>
|
||||||
<h1 class="pf-c-title pf-m-3xl">${this.challenge.flowInfo?.title}</h1>
|
<span slot="body"> ${t`You've successfully authenticated your device.`} </span>
|
||||||
</header>
|
</ak-empty-state>`;
|
||||||
<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>`;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
// As this wouldn't really be a redirect, show a message that the page can be closed
|
||||||
// and try to close it ourselves
|
// and try to close it ourselves
|
||||||
if (!url.protocol.startsWith("http")) {
|
if (!url.protocol.startsWith("http")) {
|
||||||
setTimeout(() => {
|
|
||||||
window.close();
|
|
||||||
}, 500);
|
|
||||||
return html`<ak-empty-state
|
return html`<ak-empty-state
|
||||||
icon="fas fa-check"
|
icon="fas fa-check"
|
||||||
header=${t`You may close this page now.`}
|
header=${t`You may close this page now.`}
|
||||||
|
|
Reference in New Issue