Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer
2024-09-03 19:51:11 +02:00
parent 7e6f36b0b4
commit a407d903ab
4 changed files with 37 additions and 22 deletions

View File

@ -9,9 +9,5 @@ export function themeImage(rawPath: string) {
? UiThemeEnum.Light
: UiThemeEnum.Dark;
}
const final = rawPath.replaceAll("%(theme)s", enabledTheme);
if (window.authentik_sdk?.base) {
return `${window.authentik_sdk.base}${final}`;
}
return final;
return rawPath.replaceAll("%(theme)s", enabledTheme);
}

View File

@ -84,6 +84,7 @@ export class FlowExecutor extends Interface implements StageHost {
return [PFBase, PFLogin, PFDrawer, PFButton, PFTitle, PFList, PFBackgroundImage].concat(css`
:host {
--pf-c-login__main-body--PaddingBottom: var(--pf-global--spacer--2xl);
position: relative;
}
.pf-c-background-image::before {
--pf-c-background-image--BackgroundImage: var(--ak-flow-background);
@ -95,9 +96,6 @@ export class FlowExecutor extends Interface implements StageHost {
.ak-hidden {
display: none;
}
:host {
position: relative;
}
.pf-c-drawer__content {
background-color: transparent;
}
@ -469,18 +467,20 @@ export class FlowExecutor extends Interface implements StageHost {
${this.loading && this.challenge
? html`<ak-loading-overlay></ak-loading-overlay>`
: nothing}
<div class="pf-c-login__main-header pf-c-brand ak-brand">
<img
src="${themeImage(
first(
this.brand?.brandingLogo,
globalAK()?.brand.brandingLogo,
DefaultBrand.brandingLogo,
),
)}"
alt="authentik Logo"
/>
</div>
${isEmbedded()
? nothing
: html` <div class="pf-c-login__main-header pf-c-brand ak-brand">
<img
src="${themeImage(
first(
this.brand?.brandingLogo,
globalAK()?.brand.brandingLogo,
DefaultBrand.brandingLogo,
),
)}"
alt="authentik Logo"
/>
</div>`}
${until(this.renderChallenge())}
</div>
${isEmbedded()

View File

@ -99,6 +99,7 @@ export class IdentificationStage extends BaseStage<
createHelperForm(): void {
const compatMode = "ShadyDOM" in window;
this.form = document.createElement("form");
this.form.style.display = "none";
document.documentElement.appendChild(this.form);
// Only add the additional username input if we're in a shadow dom
// otherwise it just confuses browsers

View File

@ -1,5 +1,5 @@
import "@goauthentik/elements/messages/MessageContainer";
import "@goauthentik/flow/FlowExecutor";
import { FlowExecutor } from "@goauthentik/flow/FlowExecutor";
// Statically import some stages to speed up load speed
import "@goauthentik/flow/stages/access_denied/AccessDeniedStage";
// Import webauthn-related stages to prevent issues on safari
@ -12,5 +12,23 @@ import "@goauthentik/flow/stages/captcha/CaptchaStage";
import "@goauthentik/flow/stages/identification/IdentificationStage";
import "@goauthentik/flow/stages/password/PasswordStage";
import "@goauthentik/sdk/common";
// end of stage import
import { html, nothing } from "lit";
import { customElement } from "lit/decorators.js";
import { until } from "lit/directives/until.js";
@customElement("ak-embedded-flow-executor")
export class EmbeddedFlowExecutor extends FlowExecutor {
renderCard() {
return html`<div class="pf-c-login">
<div class="pf-c-login__main">
${this.loading && this.challenge
? html`<ak-loading-overlay></ak-loading-overlay>`
: nothing}
${until(this.renderChallenge())}
</div>
</div>`;
}
}