diff --git a/authentik/events/geo.py b/authentik/events/geo.py index e6bbd6b54..b249a562e 100644 --- a/authentik/events/geo.py +++ b/authentik/events/geo.py @@ -10,7 +10,7 @@ from authentik.lib.config import CONFIG def get_geoip_reader() -> Optional[Reader]: """Get GeoIP Reader, if configured, otherwise none""" path = CONFIG.y("authentik.geoip") - if path == "": + if path == "" or not path: return None return Reader(path) diff --git a/web/src/common/styles.ts b/web/src/common/styles.ts index 41ec8d363..0480da4a6 100644 --- a/web/src/common/styles.ts +++ b/web/src/common/styles.ts @@ -1,3 +1,4 @@ +import { css, CSSResult } from "lit-element"; // @ts-ignore import PF from "@patternfly/patternfly/patternfly.css"; // @ts-ignore @@ -6,10 +7,31 @@ import PFAddons from "@patternfly/patternfly/patternfly-addons.css"; import FA from "@fortawesome/fontawesome-free/css/fontawesome.css"; // @ts-ignore import AKGlobal from "../authentik.css"; -import { CSSResult } from "lit-element"; // @ts-ignore import CodeMirrorStyle from "codemirror/lib/codemirror.css"; // @ts-ignore import CodeMirrorTheme from "codemirror/theme/monokai.css"; - -export const COMMON_STYLES: CSSResult[] = [PF, PFAddons, FA, AKGlobal, CodeMirrorStyle, CodeMirrorTheme]; +export const ColorStyles = css` + .pf-m-success { + color: var(--pf-global--success-color--100); + } + .pf-c-button.pf-m-success { + color: var(--pf-c-button--m-primary--Color); + background-color: var(--pf-global--success-color--100); + } + .pf-m-warning { + color: var(--pf-global--warning-color--100); + } + .pf-c-button.pf-m-warning { + color: var(--pf-c-button--m-primary--Color); + background-color: var(--pf-global--warning-color--100); + } + .pf-m-danger { + color: var(--pf-global--danger-color--100); + } + .pf-c-button.pf-m-danger { + color: var(--pf-c-button--m-primary--Color); + background-color: var(--pf-global--danger-color--100); + } +`; +export const COMMON_STYLES: CSSResult[] = [PF, PFAddons, FA, AKGlobal, CodeMirrorStyle, CodeMirrorTheme, ColorStyles]; diff --git a/web/src/constants.ts b/web/src/constants.ts index 73871e963..9079f262a 100644 --- a/web/src/constants.ts +++ b/web/src/constants.ts @@ -1,31 +1,6 @@ -import { css } from "lit-element"; - export const PRIMARY_CLASS = "pf-m-primary"; export const SUCCESS_CLASS = "pf-m-success"; export const ERROR_CLASS = "pf-m-danger"; export const PROGRESS_CLASS = "pf-m-in-progress"; export const CURRENT_CLASS = "pf-m-current"; -export const ColorStyles = css` - .pf-m-success { - color: var(--pf-global--success-color--100); - } - .pf-c-button.pf-m-success { - color: var(--pf-c-button--m-primary--Color); - background-color: var(--pf-global--success-color--100); - } - .pf-m-warning { - color: var(--pf-global--warning-color--100); - } - .pf-c-button.pf-m-warning { - color: var(--pf-c-button--m-primary--Color); - background-color: var(--pf-global--warning-color--100); - } - .pf-m-danger { - color: var(--pf-global--danger-color--100); - } - .pf-c-button.pf-m-danger { - color: var(--pf-c-button--m-primary--Color); - background-color: var(--pf-global--danger-color--100); - } -`; export const VERSION = "2021.2.5-stable"; diff --git a/web/src/elements/buttons/SpinnerButton.ts b/web/src/elements/buttons/SpinnerButton.ts index eb80c083a..2a5982922 100644 --- a/web/src/elements/buttons/SpinnerButton.ts +++ b/web/src/elements/buttons/SpinnerButton.ts @@ -5,7 +5,8 @@ import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css"; import ButtonStyle from "@patternfly/patternfly/components/Button/button.css"; // @ts-ignore import SpinnerStyle from "@patternfly/patternfly/components/Spinner/spinner.css"; -import { ColorStyles, PRIMARY_CLASS, PROGRESS_CLASS } from "../../constants"; +import { PRIMARY_CLASS, PROGRESS_CLASS } from "../../constants"; +import { ColorStyles } from "../../common/styles"; @customElement("ak-spinner-button") export class SpinnerButton extends LitElement { diff --git a/web/src/elements/buttons/TokenCopyButton.ts b/web/src/elements/buttons/TokenCopyButton.ts index 075469812..ee8b214df 100644 --- a/web/src/elements/buttons/TokenCopyButton.ts +++ b/web/src/elements/buttons/TokenCopyButton.ts @@ -4,7 +4,8 @@ import GlobalsStyle from "@patternfly/patternfly/base/patternfly-globals.css"; // @ts-ignore import ButtonStyle from "@patternfly/patternfly/components/Button/button.css"; import { Token } from "../../api/Tokens"; -import { ColorStyles, ERROR_CLASS, PRIMARY_CLASS, SUCCESS_CLASS } from "../../constants"; +import { ERROR_CLASS, PRIMARY_CLASS, SUCCESS_CLASS } from "../../constants"; +import { ColorStyles } from "../../common/styles"; @customElement("ak-token-copy-button") export class TokenCopyButton extends LitElement { diff --git a/web/src/elements/cards/AggregateCard.ts b/web/src/elements/cards/AggregateCard.ts index 4f21daf5f..101114df0 100644 --- a/web/src/elements/cards/AggregateCard.ts +++ b/web/src/elements/cards/AggregateCard.ts @@ -2,7 +2,6 @@ import { gettext } from "django"; import { css, CSSResult, customElement, html, LitElement, property, TemplateResult } from "lit-element"; import { ifDefined } from "lit-html/directives/if-defined"; import { COMMON_STYLES } from "../../common/styles"; -import { ColorStyles } from "../../constants"; @customElement("ak-aggregate-card") export class AggregateCard extends LitElement { @@ -25,7 +24,7 @@ export class AggregateCard extends LitElement { text-align: center; color: var(--pf-global--Color--100); } - `, ColorStyles]); + `]); } renderInner(): TemplateResult { diff --git a/web/src/elements/router/RouterOutlet.ts b/web/src/elements/router/RouterOutlet.ts index 513597975..6439bb0d2 100644 --- a/web/src/elements/router/RouterOutlet.ts +++ b/web/src/elements/router/RouterOutlet.ts @@ -3,7 +3,6 @@ import { css, CSSResult, customElement, html, LitElement, property, TemplateResu import CodeMirrorStyle from "codemirror/lib/codemirror.css"; // @ts-ignore import CodeMirrorTheme from "codemirror/theme/monokai.css"; -import { ColorStyles } from "../../constants"; import { COMMON_STYLES } from "../../common/styles"; import { Route } from "./Route"; import { ROUTES } from "../../routes"; @@ -24,7 +23,6 @@ export class RouterOutlet extends LitElement { return [ CodeMirrorStyle, CodeMirrorTheme, - ColorStyles, css` :host { height: 100vh;