web: Locale selector
Details
This PR adds a locale selector to the flow executor.
Changes
- API middleware now synchronizes with the current locale
- Selecting a locale persists the preference for the browser session. After authentication, user attributes take priority over the session preference (if any user attributes exist)
- Removed commented-out context controller code
Screenshots
Deploy Preview for authentik-docs canceled.
| Name | Link |
|---|---|
| Latest commit | 0369c13a57e58e9c172dbad1c8673024711c607a |
| Latest deploy log | https://app.netlify.com/projects/authentik-docs/deploys/6939c5a393e2020008f8396f |
Deploy Preview for authentik-storybook ready!
| Name | Link |
|---|---|
| Latest commit | 0369c13a57e58e9c172dbad1c8673024711c607a |
| Latest deploy log | https://app.netlify.com/projects/authentik-storybook/deploys/6939c5a313270b0007c977a1 |
| Deploy Preview | https://deploy-preview-18560--authentik-storybook.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
Deploy Preview for authentik-integrations canceled.
| Name | Link |
|---|---|
| Latest commit | 0369c13a57e58e9c172dbad1c8673024711c607a |
| Latest deploy log | https://app.netlify.com/projects/authentik-integrations/deploys/6939c5a3ead6790008d6c8b9 |
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 93.22%. Comparing base (572d965) to head (0369c13).
:warning: Report is 1 commits behind head on main.
:white_check_mark: All tests successful. No failed tests found.
Additional details and impacted files
@@ Coverage Diff @@
## main #18560 +/- ##
==========================================
+ Coverage 93.00% 93.22% +0.22%
==========================================
Files 946 946
Lines 51770 51770
==========================================
+ Hits 48147 48261 +114
+ Misses 3623 3509 -114
| Flag | Coverage Ξ | |
|---|---|---|
| e2e | 44.80% <ΓΈ> (+1.06%) |
:arrow_up: |
| integration | 23.30% <ΓΈ> (+<0.01%) |
:arrow_up: |
| unit | 91.45% <ΓΈ> (ΓΈ) |
|
| unit-migrate | 91.50% <ΓΈ> (ΓΈ) |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
authentik PR Installation instructions
Instructions for docker-compose
Add the following block to your .env file:
AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-0369c13a57e58e9c172dbad1c8673024711c607a
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
Afterwards, run the upgrade commands from the latest release notes.
Instructions for Kubernetes
Add the following block to your values.yml file:
authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-0369c13a57e58e9c172dbad1c8673024711c607a
Afterwards, run the upgrade commands from the latest release notes.
@BeryJu
Thank you for the review π
Should this persist the the locale change to the URL? (I dont have an opinion on this, both methods have upsides and downsides)
IMO the query param is nice because it keeps the locale stable, but it makes link sharing a bit troublesome and may not survive across redirects. The latest iteration uses sessionStorage. Selecting a locale persists the preference for the tab's lifecycle. After authentication, user attributes take priority over the session preference (if any user attributes exist)
It should refresh at least the challenge and probably use a middleware to set the Accept-Language header for API requests since that'll influence which strings we get from the server
I've updated the API middleware to synchronize with the current locale, which has a nice effect on the UI for the client-side strings, but I've observed that the flow executor doesn't handle repeat requests. Invoking FlowsApi.flowsExecutorGet after changing the locale can result in an access denied -- maybe something to do with an expectation of subsequent API calls being tied to flow progression?