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" msgid "To"
msgstr "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 #: src/pages/users/UserListPage.ts
msgid "To directly reset a user's password, configure a recovery flow on the currently active tenant." 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." 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" msgid "To"
msgstr "" 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 #: src/pages/users/UserListPage.ts
msgid "To directly reset a user's password, configure a recovery flow on the currently active tenant." msgid "To directly reset a user's password, configure a recovery flow on the currently active tenant."
msgstr "" msgstr ""

View file

@ -197,6 +197,7 @@ export class UserViewPage extends LitElement {
</div> </div>
<div class="pf-c-card__footer"> <div class="pf-c-card__footer">
<ak-action-button <ak-action-button
class="pf-m-secondary"
.apiRequest=${() => { .apiRequest=${() => {
return new CoreApi(DEFAULT_CONFIG) return new CoreApi(DEFAULT_CONFIG)
.coreUsersRecoveryRetrieve({ .coreUsersRecoveryRetrieve({
@ -208,6 +209,13 @@ export class UserViewPage extends LitElement {
message: t`Successfully generated recovery link`, message: t`Successfully generated recovery link`,
description: rec.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: "",
});
}); });
}} }}
> >