web/admin: handle error correctly when creating user recovery link

closes #1472

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-09-26 11:49:40 +02:00
parent 234a5e2b66
commit 05db9e5c40
3 changed files with 16 additions and 0 deletions

View File

@ -4552,6 +4552,10 @@ msgstr "Title"
msgid "To"
msgstr "To"
#: src/pages/users/UserViewPage.ts
msgid "To create a recovery link, the current tenant needs to have a recovery flow configured."
msgstr "To create a recovery link, the current tenant needs to have a recovery flow configured."
#: src/pages/users/UserListPage.ts
msgid "To directly reset a user's password, configure a recovery flow on the currently active tenant."
msgstr "To directly reset a user's password, configure a recovery flow on the currently active tenant."

View File

@ -4537,6 +4537,10 @@ msgstr ""
msgid "To"
msgstr ""
#: src/pages/users/UserViewPage.ts
msgid "To create a recovery link, the current tenant needs to have a recovery flow configured."
msgstr ""
#: src/pages/users/UserListPage.ts
msgid "To directly reset a user's password, configure a recovery flow on the currently active tenant."
msgstr ""

View File

@ -197,6 +197,7 @@ export class UserViewPage extends LitElement {
</div>
<div class="pf-c-card__footer">
<ak-action-button
class="pf-m-secondary"
.apiRequest=${() => {
return new CoreApi(DEFAULT_CONFIG)
.coreUsersRecoveryRetrieve({
@ -208,6 +209,13 @@ export class UserViewPage extends LitElement {
message: t`Successfully generated recovery link`,
description: rec.link,
});
})
.catch(() => {
showMessage({
level: MessageLevel.error,
message: t`To create a recovery link, the current tenant needs to have a recovery flow configured.`,
description: "",
});
});
}}
>