web/admin: improve user email button labels#7233
web/admin: improve user email button labels#7233kensternberg-authentik merged 8 commits intomainfrom
Conversation
We would like to use the clipboard for more than just the token copy button. This commit enables that by separating the "Write to Clipboard" and "Write to Notifications" routines into separate functions, putting "writeToClipboard" into the utilities collection, and clarifying what happens when a custom presses the TokenCopy button.
UserViewPage and UserLinkPage have the same functionality to request to view a link with which a user may access an account recovery flow. The language and error messages were different on both of those pages. This commit harmonizes the language by making the request a standalone function. It also exploits the breakout of the "write to clipboard" commit to write the link to the clipboard, and to inform the user that the clipboard has been written to, when possible.
Since the UserListPage's "accordion" view has an offer to "Email the recovery link" to the user, it seemed appropriate to grant the same capability to the UserListPage.
After a bit of messing around, I have also ensured that the gap between the buttons is the same in all cases, that in the columnar display the buttons are of uniform width, and that the buttons have the same next: - "Set Password" - "View Recovery Link" - "Email Recovery Link" NOTE: This commit is contingent upon the PR for [isolate clipboard handling](#7229) to be accepted, as it relies on the clipboard handler for the "write link to clipboard" feature.
Every `...render()` method in the UserViewPage class has a preamble
guard clause:
```
if (!this.user) {
return html``;
}
```
With this clause, it should not be necessary to repeatedly check
the type of `this.user` throughout the rest of the method, but the
nominal type is `User?`, which means that functions called from
within the method need to be protected against `undefined` failure.
By creating a new variable with the type after the guard clause,
we ensure the type is `User` (no question!) and can safely use it
without those checks.
Along the way, I replaced the empty html with `nothing` and corrected
(mostly by removing) the return types.
References:
- [Lit-HTML: Prefer `nothing` over empty html or other falsey walues](https://lit.dev/docs/api/templates/#nothing)
- [TypeScript: Type annotations on return types are rarely
necessary](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#:~:text=Return%20Type%20Annotations&text=Much%20like%20variable%20type%20annotations,example%20doesn't%20change%20anything.)
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
| UserPath, | ||
| } from "@goauthentik/api"; | ||
|
|
||
| export const requestRecoveryLink = (user: User) => |
There was a problem hiding this comment.
Breaking these two bits of functionality out so that they can be consistent between the two pages.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7233 +/- ##
==========================================
- Coverage 52.59% 51.78% -0.81%
==========================================
Files 587 587
Lines 28853 28853
==========================================
- Hits 15175 14942 -233
- Misses 13678 13911 +233
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-web-improve-email-button-labels-1697759259-98c886b
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sFor arm64, use these values: AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-web-improve-email-button-labels-1697759259-98c886b-arm64
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-web-improve-email-button-labels-1697759259-98c886bFor arm64, use these values: authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-web-improve-email-button-labels-1697759259-98c886b-arm64Afterwards, run the upgrade commands from the latest release notes. |
* main: web: bump API Client version (#7246) sources/oauth: include default JWKS URLs for OAuth sources (#6992) sources/oauth: periodically update OAuth sources' OIDC configuration (#7245) website/blogs: Fix sso blog to remove 3rd reason (#7230) lifecycle: fix otp_merge migration again (#7244) web: bump core-js from 3.33.0 to 3.33.1 in /web (#7243) core: bump node from 20 to 21 (#7237) web: fix bad comment that was confusing lit-analyze (#7234) translate: Updates for file web/xliff/en.xlf in zh_CN (#7235) core: bump ruff from 0.1.0 to 0.1.1 (#7238) core: bump twilio from 8.9.1 to 8.10.0 (#7239) web: bump the storybook group in /web with 5 updates (#7240) web: bump the wdio group in /tests/wdio with 4 updates (#7241) translate: Updates for file web/xliff/en.xlf in zh-Hans (#7236)
Details
Label consistency:
UserViewPageandUserLinkPagehave the same functionality to request to view a link with which a user may access an account recovery flow. The language and error messages were different on both of those pages. This commit harmonizes the language by making the request a standalone function. It also exploits the breakout of the “write to clipboard” commit to write the link to the clipboard, and to inform the user that the clipboard has been written to, when possible.Functionality:
Since the
UserListPage’s “accordion” view has an offer to “Email the recovery link” to the user, it seemed appropriate to grant the same capability to the UserListPage.Visual consistency:
After a bit of messing around, I have also ensured that the gap between the buttons is the same in all cases, that in the columnar display the buttons are of uniform width.
Remove
or undefinedclauses onthis.user, as they shouldn’t be neededEvery
...render()method in theUserViewPageclass has a preamble guard clause:With this clause, it should not be necessary to repeatedly check the type of
this.userthroughout the rest of the method, but the nominal type isUser?, which means that functions called from within the method need to be protected againstundefinedfailure. By creating a new variable with the type after the guard clause, we ensure the type isUser(no question!) and can safely use it without those checks.Along the way, I replaced the empty html with
nothingand corrected (mostly by removing) the return types.References:
nothingover empty html or other falsey valuesCaveats
NOTE: This commit is contingent upon the PR for isolate clipboard handling to be accepted, as it relies on the clipboard handler for the “write link to clipboard” feature.
Checklist
ak test authentik/)make lint-fix)If an API change has been made
make gen-build)If changes to the frontend have been made
make web)make i18n-extract)If applicable
make website)