diff --git a/web/src/elements/forms/DeleteBulkForm.ts b/web/src/elements/forms/DeleteBulkForm.ts index 1222ecbf3..e8d6deb7d 100644 --- a/web/src/elements/forms/DeleteBulkForm.ts +++ b/web/src/elements/forms/DeleteBulkForm.ts @@ -187,6 +187,7 @@ export class DeleteBulkForm extends ModalButton {

${t`Are you sure you want to delete ${this.objects.length} ${this.objectLabel}?`}

+
diff --git a/web/src/locales/en.po b/web/src/locales/en.po index 111cd56bd..7ef86c531 100644 --- a/web/src/locales/en.po +++ b/web/src/locales/en.po @@ -5205,6 +5205,7 @@ msgid "UI settings" msgstr "UI settings" #: src/pages/events/EventInfo.ts +#: src/pages/users/UserListPage.ts msgid "UID" msgstr "UID" @@ -5770,6 +5771,10 @@ msgstr "Warning: Provider is not used by any Outpost." msgid "Warning: Provider not assigned to any application." msgstr "Warning: Provider not assigned to any application." +#: src/pages/users/UserListPage.ts +msgid "Warning: You're about to delete the user you're logged in as ({0}). Proceed at your own risk." +msgstr "Warning: You're about to delete the user you're logged in as ({0}). Proceed at your own risk." + #: src/pages/outposts/OutpostListPage.ts msgid "Warning: authentik Domain is not configured, authentication will not work." msgstr "Warning: authentik Domain is not configured, authentication will not work." diff --git a/web/src/locales/fr_FR.po b/web/src/locales/fr_FR.po index eabb84352..7838b5efb 100644 --- a/web/src/locales/fr_FR.po +++ b/web/src/locales/fr_FR.po @@ -5146,6 +5146,7 @@ msgid "UI settings" msgstr "Paramètres d'UI" #: src/pages/events/EventInfo.ts +#: src/pages/users/UserListPage.ts msgid "UID" msgstr "UID" @@ -5708,6 +5709,10 @@ msgstr "" msgid "Warning: Provider not assigned to any application." msgstr "Avertissement : le fournisseur n'est assigné à aucune application." +#: src/pages/users/UserListPage.ts +msgid "Warning: You're about to delete the user you're logged in as ({0}). Proceed at your own risk." +msgstr "" + #: src/pages/outposts/OutpostListPage.ts msgid "Warning: authentik Domain is not configured, authentication will not work." msgstr "Avertissement : le domaine d'authentik n'est pas configuré, l'authentification ne fonctionnera pas." diff --git a/web/src/locales/pseudo-LOCALE.po b/web/src/locales/pseudo-LOCALE.po index 59433f231..b024d7e92 100644 --- a/web/src/locales/pseudo-LOCALE.po +++ b/web/src/locales/pseudo-LOCALE.po @@ -5185,6 +5185,7 @@ msgid "UI settings" msgstr "" #: src/pages/events/EventInfo.ts +#: src/pages/users/UserListPage.ts msgid "UID" msgstr "" @@ -5750,6 +5751,10 @@ msgstr "" msgid "Warning: Provider not assigned to any application." msgstr "" +#: src/pages/users/UserListPage.ts +msgid "Warning: You're about to delete the user you're logged in as ({0}). Proceed at your own risk." +msgstr "" + #: src/pages/outposts/OutpostListPage.ts msgid "Warning: authentik Domain is not configured, authentication will not work." msgstr "" diff --git a/web/src/pages/users/UserListPage.ts b/web/src/pages/users/UserListPage.ts index 95e5e85f2..9c484640f 100644 --- a/web/src/pages/users/UserListPage.ts +++ b/web/src/pages/users/UserListPage.ts @@ -4,12 +4,14 @@ import { CSSResult, TemplateResult, html } from "lit"; import { customElement, property } from "lit/decorators.js"; import { until } from "lit/directives/until.js"; +import PFAlert from "@patternfly/patternfly/components/Alert/alert.css"; import PFDescriptionList from "@patternfly/patternfly/components/DescriptionList/description-list.css"; import { CoreApi, User } from "@goauthentik/api"; import { AKResponse } from "../../api/Client"; import { DEFAULT_CONFIG, tenant } from "../../api/Config"; +import { me } from "../../api/Users"; import { uiConfig } from "../../common/config"; import { PFColor } from "../../elements/Label"; import "../../elements/buttons/ActionButton"; @@ -51,7 +53,7 @@ export class UserListPage extends TablePage { hideServiceAccounts = getURLParam("hideServiceAccounts", true); static get styles(): CSSResult[] { - return super.styles.concat(PFDescriptionList); + return super.styles.concat(PFDescriptionList, PFAlert); } async apiEndpoint(page: number): Promise> { @@ -79,13 +81,14 @@ export class UserListPage extends TablePage { renderToolbarSelected(): TemplateResult { const disabled = this.selectedElements.length < 1; - return html` { return [ { key: t`Username`, value: item.username }, { key: t`ID`, value: item.pk.toString() }, + { key: t`UID`, value: item.uid }, ]; }} .usedBy=${(item: User) => { @@ -99,6 +102,28 @@ export class UserListPage extends TablePage { }); }} > + ${until( + me().then((user) => { + const shouldShowWarning = this.selectedElements.find((el) => { + return el.pk === user.user.pk || el.pk == user.original?.pk; + }); + if (shouldShowWarning) { + return html` +
+
+
+ +
+

+ ${t`Warning: You're about to delete the user you're logged in as (${shouldShowWarning.username}). Proceed at your own risk.`} +

+
+
+ `; + } + return html``; + }), + )}