Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu committed Sep 3, 2024
1 parent 7e6f36b commit a407d90
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 22 deletions.
6 changes: 1 addition & 5 deletions web/src/elements/utils/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
30 changes: 15 additions & 15 deletions web/src/flow/FlowExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions web/src/flow/stages/identification/IdentificationStage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 20 additions & 2 deletions web/src/sdk/flow.ts
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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>`;
}
}

0 comments on commit a407d90

Please sign in to comment.