authentik icon indicating copy to clipboard operation
authentik copied to clipboard

Allow edit-able flow background paths

Open fOmey opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. Currently you have to re-upload the flow background you would like to use, this leads to duplicate flow background files in /media.

Describe the solution you'd like Allow custom flow background paths, editable textbox.

fOmey avatar Jan 03 '23 01:01 fOmey

Not a fix, but a workaround to this issue is to unmount the media volume. This allows you to input a custom URL in the field value, which is easier to add dynamic images hosted on a cdn, for example.

Lanhild avatar Jan 23 '23 16:01 Lanhild

You can also update the SQL directly.

update authentik_flows_flow set background = 'https://example.com/image.png';

or for local files

update authentik_flows_flow set background = './media/background.png';

sevmonster avatar Jan 24 '23 19:01 sevmonster

Hey,

FWIW, I reached this solution (there is a somewhat limited UI when editing default-authentication-flow):

#!/bin/sh -eu
# save as set-background.sh, chmod 755 and use as:
# env TOKEN=token ./set-background.sh https://authentik.example https://authentik.example/media/public/background.png

#!/bin/sh -eu

set_authentik_background() {
        ak_url="$1"
        bg_url="$2"
        for flow_slug in $(curl -sH "Authorization: Bearer ${TOKEN}" "${ak_url}/api/v3/flows/instances/" | jq -r ".results | .[] | select(.background != \"${bg_url}\") | .slug"); do
                printf "Changing flow background: '%s'... " "${flow_slug}"
                curl -H "Authorization: Bearer ${TOKEN}" -X POST \
                        "${ak_url}/api/v3/flows/instances/${flow_slug}/set_background_url/" \
                        --json "{\"url\": \"${bg_url}\"}"
                echo
        done
}

set_authentik_background "$1" "$2"

By using the different slugs of different flows in the URL parameter (instead of default-authentication-flow), I guess it can be done on all flows as asked in #4586.

Note: the URL has to either be absolute or not start with /static in order not to have the wrong unsplash attribution.

I'd rather do it like this as it uses the API and gives us some notion of stability :-).

evilham avatar Mar 26 '24 12:03 evilham

kinda duplicate of #3974, we'll be adding a default background image setting in the brand which will affect flows that don't have a custom image set

BeryJu avatar Apr 18 '24 16:04 BeryJu