handle errors self for disable user mfa provider
This commit is contained in:
@@ -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',
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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) },
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user