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

Bug: T354538
Change-Id: I242dad188c94ec59c4a181f72cf9e3cd0d6f3529
This commit is contained in:
Reedy 2024-01-11 23:23:02 +00:00
parent a0c70e1eaa
commit 5d5c9365c7
3 changed files with 25 additions and 7 deletions

View file

@ -81,8 +81,10 @@
"oathauth-disable-method-warning-header": "Confirm disabling of an authentication method", "oathauth-disable-method-warning-header": "Confirm disabling of an authentication method",
"oathauth-disable-method-warning-button-label": "Confirm and continue", "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-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-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-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-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", "oathauth-invalidrequest": "Invalid request",
"notification-header-oathauth-disable": "Two-factor authentication has been disabled on {{GENDER:$2|your account}}.", "notification-header-oathauth-disable": "Two-factor authentication has been disabled on {{GENDER:$2|your account}}.",

View file

@ -96,8 +96,10 @@
"oathauth-disable-method-warning-header": "Page title for warning page when disabling current 2FA method", "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-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-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-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-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-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", "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", "notification-header-oathauth-disable": "Notification header for when two-factor authentication has been disabled.\n$2 - Name of user for GENDER",

View file

@ -365,16 +365,18 @@ class OATHManage extends SpecialPage {
'framed' => true, 'framed' => true,
'expanded' => false 'expanded' => false
] ); ] );
$headerMessage = $this->isSwitch() ?
$this->msg( 'oathauth-switch-method-warning-header' ) : $isSwitch = $this->isSwitch();
$this->msg( 'oathauth-disable-method-warning-header' ); $currentDisplayName = $this->authUser->getModule()->getDisplayName();
$genericMessage = $this->isSwitch() ? $newDisplayName = $this->requestedModule->getDisplayName();
$genericMessage = $isSwitch ?
$this->msg( $this->msg(
'oathauth-switch-method-warning', 'oathauth-switch-method-warning',
$this->authUser->getModule()->getDisplayName(), $currentDisplayName,
$this->requestedModule->getDisplayName() $newDisplayName
) : ) :
$this->msg( 'oathauth-disable-method-warning', $this->authUser->getModule()->getDisplayName() ); $this->msg( 'oathauth-disable-method-warning', $currentDisplayName );
$panel->appendContent( new HtmlSnippet( $panel->appendContent( new HtmlSnippet(
$genericMessage->parseAsBlock() $genericMessage->parseAsBlock()
@ -387,6 +389,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( [ $button = new ButtonWidget( [
'label' => $this->msg( 'oathauth-disable-method-warning-button-label' )->plain(), 'label' => $this->msg( 'oathauth-disable-method-warning-button-label' )->plain(),
'href' => $this->getOutput()->getTitle()->getLocalURL( [ 'href' => $this->getOutput()->getTitle()->getLocalURL( [
@ -397,6 +407,10 @@ class OATHManage extends SpecialPage {
] ); ] );
$panel->appendContent( $button ); $panel->appendContent( $button );
$headerMessage = $isSwitch ?
$this->msg( 'oathauth-switch-method-warning-header' ) :
$this->msg( 'oathauth-disable-method-warning-header' );
$this->getOutput()->setPageTitleMsg( $headerMessage ); $this->getOutput()->setPageTitleMsg( $headerMessage );
$this->getOutput()->addHTML( $panel->toString() ); $this->getOutput()->addHTML( $panel->toString() );
} }