OATHManage: Add messages to signify 2FA auth is needed to continue action

Bug: T354538
Change-Id: I242dad188c94ec59c4a181f72cf9e3cd0d6f3529
(cherry picked from commit 5d5c9365c7)
This commit is contained in:
Reedy 2024-01-11 23:23:02 +00:00
parent aabcdb578f
commit 78153a88f4
3 changed files with 26 additions and 8 deletions

View file

@ -83,8 +83,10 @@
"oathauth-disable-method-warning-header": "Confirm disabling of an authentication method",
"oathauth-disable-method-warning-button-label": "Confirm and continue",
"oathauth-disable-method-warning": "If you disable $1 two-factor authentication method, you will no longer be able to use this method when logging in, and all the data associated with this authentication method will be deleted.",
"oathauth-disable-method-next-step": "On the next step, you will be required to authenticate yourself with your current two-factor authentication method ($1) to be able to disable it.",
"oathauth-switch-method-warning-header": "Confirm switching to a different authentication method",
"oathauth-switch-method-warning": "By switching to $2 two-factor authentication method, current method ($1) will be disabled, and all the data associated with the current authentication method will be deleted",
"oathauth-switch-method-next-step": "On the next step, you will be required to authenticate yourself with your current two-factor authentication method ($1) to be able to switch to $2.",
"oathauth-totp-disable-warning": "You will no longer be able to use the authentication device registered with this account. All recovery codes associated with this account will be invalidated.",
"oathauth-invalidrequest": "Invalid request",
"notification-header-oathauth-disable": "Two-factor authentication has been disabled on {{GENDER:$2|your account}}.",

View file

@ -98,8 +98,10 @@
"oathauth-disable-method-warning-header": "Page title for warning page when disabling current 2FA method",
"oathauth-disable-method-warning-button-label": "Label for the button that confirms disabling current or switching to alternative 2FA method",
"oathauth-disable-method-warning": "Generic message warning the user of token/data loss when authentication method is disabled.\n$1 - Current method name",
"oathauth-disable-method-next-step": "Message telling user they will need to use their 2FA method on the next step to continue disabling it.\n$1 - Current method name",
"oathauth-switch-method-warning-header": "Page title for warning page when switching to an alternative 2FA method",
"oathauth-switch-method-warning": "Generic message warning the user of token/data loss when switching to an alternative method.\n$1 - Current method name, $2 - Name of the method that is being switched to",
"oathauth-switch-method-next-step": "Message telling user they will need to use their 2FA method on the next step to continue switching it..\n$1 - Current method name, $2 - Name of the method that is being switched to",
"oathauth-totp-disable-warning": "TOTP specific warning message when disabling/switching to alternative 2FA method",
"oathauth-invalidrequest": "Generic error message that is displayed when request cannot be processed due to an unpredicted reason",
"notification-header-oathauth-disable": "Notification header for when two-factor authentication has been disabled.\n$2 - Name of user for GENDER",

View file

@ -371,16 +371,18 @@ class OATHManage extends SpecialPage {
'framed' => true,
'expanded' => false
] );
$headerMessage = $this->isSwitch() ?
$this->msg( 'oathauth-switch-method-warning-header' ) :
$this->msg( 'oathauth-disable-method-warning-header' );
$genericMessage = $this->isSwitch() ?
$isSwitch = $this->isSwitch();
$currentDisplayName = $this->getEnabled()->getDisplayName();
$newDisplayName = $this->requestedModule->getDisplayName();
$genericMessage = $isSwitch ?
$this->msg(
'oathauth-switch-method-warning',
$this->getEnabled()->getDisplayName(),
$this->requestedModule->getDisplayName()
$currentDisplayName,
$newDisplayName
) :
$this->msg( 'oathauth-disable-method-warning', $this->getEnabled()->getDisplayName() );
$this->msg( 'oathauth-disable-method-warning', $currentDisplayName );
$panel->appendContent( new HtmlSnippet(
$genericMessage->parseAsBlock()
@ -393,6 +395,14 @@ class OATHManage extends SpecialPage {
) );
}
$nextStepMessage = $isSwitch ?
$this->msg( 'oathauth-switch-method-next-step', $currentDisplayName ) :
$this->msg( 'oathauth-disable-method-next-step', $currentDisplayName, $newDisplayName );
$panel->appendContent( new HtmlSnippet(
$nextStepMessage->parseAsBlock()
) );
$button = new ButtonWidget( [
'label' => $this->msg( 'oathauth-disable-method-warning-button-label' )->plain(),
'href' => $this->getOutput()->getTitle()->getLocalURL( [
@ -403,7 +413,11 @@ class OATHManage extends SpecialPage {
] );
$panel->appendContent( $button );
$this->getOutput()->setPageTitle( $headerMessage );
$headerMessage = $isSwitch ?
$this->msg( 'oathauth-switch-method-warning-header' ) :
$this->msg( 'oathauth-disable-method-warning-header' );
$this->getOutput()->setPageTitleMsg( $headerMessage );
$this->getOutput()->addHTML( $panel->toString() );
}