add provider displayName to the enabled notifications

This commit is contained in:
Jacob Overgaard
2024-04-03 13:44:58 +02:00
parent 2583152d2f
commit c354b7a2ca
3 changed files with 13 additions and 5 deletions

View File

@@ -1932,8 +1932,8 @@ export default {
'2faDisableText':
'If you wish to disable this two-factor provider, then you must enter the code shown on your authentication device:',
'2faProviderIsEnabled': 'This two-factor provider is enabled',
'2faProviderIsEnabledMsg': 'This two-factor provider is now enabled',
'2faProviderIsNotEnabledMsg': 'Something went wrong with trying to enable this two-factor provider',
'2faProviderIsEnabledMsg': '{0} is now enabled',
'2faProviderIsNotEnabledMsg': 'Something went wrong with trying to enable {0}',
'2faProviderIsDisabledMsg': '{0} is now disabled',
'2faProviderIsNotDisabledMsg': 'Something went wrong with trying to disable {0}',
'2faDisableForUser': 'Do you want to disable "{0}" on this user?',

View File

@@ -150,7 +150,7 @@ export class UmbMfaProviderDefaultElement extends UmbLitElement implements UmbMf
protected peek(message: string, color?: UmbNotificationColor) {
this.notificationContext?.peek(color ?? 'positive', {
data: {
headline: this.localize.term('member_2fa'),
headline: `${this.localize.term('member_2fa')} ${this.displayName ?? this.providerName}`,
message,
},
});
@@ -177,10 +177,14 @@ export class UmbMfaProviderDefaultElement extends UmbLitElement implements UmbMf
const successful = await this.callback(this.providerName, code, this._secret);
if (successful) {
this.peek(this.localize.term('user_2faProviderIsEnabled'));
this.peek(this.localize.term('user_2faProviderIsEnabledMsg', this.displayName ?? this.providerName));
this._buttonState = 'success';
this.close();
} else {
this.peek(
this.localize.term('user_2faProviderIsNotEnabledMsg', this.displayName ?? this.providerName),
'warning',
);
this.codeField?.setCustomValidity(this.localize.term('user_2faInvalidCode'));
this.codeField?.focus();
this._buttonState = 'failed';

View File

@@ -102,10 +102,14 @@ export class UmbCurrentUserMfaDisableProviderModalElement extends UmbModalBaseEl
const success = await this.#currentUserRepository.disableMfaProvider(this.data.providerName, code);
if (success) {
this.#peek(this.localize.term('user_2faProviderIsDisabledMsg', this.data.displayName));
this.#peek(this.localize.term('user_2faProviderIsDisabledMsg', this.data.displayName ?? this.data.providerName));
this.modalContext?.submit();
this._buttonState = 'success';
} else {
this.#peek(
this.localize.term('user_2faProviderIsNotDisabledMsg', this.data.displayName ?? this.data.providerName),
'warning',
);
this._codeInput.setCustomValidity(this.localize.term('user_2faInvalidCode'));
this._codeInput.focus();
this._buttonState = 'failed';