handle errors self for disable user mfa provider

This commit is contained in:
Jacob Overgaard
2024-04-03 16:34:01 +02:00
parent a1a43d46ea
commit 86f68fd325
3 changed files with 4 additions and 4 deletions

View File

@@ -126,7 +126,7 @@ export class UmbUserMfaModalElement extends UmbLitElement {
*/
async #onProviderDisable(item: UmbMfaLoginProviderOption) {
await umbConfirmModal(this, {
headline: `${this.localize.term('actions_disable')} "${item.displayName}"`,
headline: this.localize.term('actions_disable'),
content: this.localize.term('user_2faDisableForUser', item.displayName),
confirmLabel: this.localize.term('actions_disable'),
color: 'danger',

View File

@@ -1,6 +1,6 @@
import { UserResource } from '@umbraco-cms/backoffice/external/backend-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
import { tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
import { tryExecute, tryExecuteAndNotify } from '@umbraco-cms/backoffice/resources';
/**
* A data source for User MFA items that fetches data from the server
@@ -45,8 +45,7 @@ export class UmbUserMfaServerDataSource {
if (!unique) throw new Error('User id is missing');
if (!providerName) throw new Error('Provider is missing');
return tryExecuteAndNotify(
this.#host,
return tryExecute(
UserResource.deleteUserById2FaByProviderName({
id: unique,
providerName,

View File

@@ -49,6 +49,7 @@ export class UmbUserRepository extends UmbUserRepositoryBase {
};
this.notificationContext?.peek('positive', notification);
} else {
console.error('Failed to disable MFA provider', error);
const notification = {
data: { message: localize.term('user_2faProviderIsNotDisabledMsg', displayName ?? providerName) },
};