Merge "OATHManage: Add messages to signify 2FA auth is needed to continue action" into REL1_42

This commit is contained in:
jenkins-bot 2024-11-02 16:14:21 +00:00 committed by Gerrit Code Review
commit 980faaec2f
3 changed files with 25 additions and 7 deletions

View file

@ -82,8 +82,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

@ -97,8 +97,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

@ -346,16 +346,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->authUser->getModule()->getDisplayName();
$newDisplayName = $this->requestedModule->getDisplayName();
$genericMessage = $isSwitch ?
$this->msg(
'oathauth-switch-method-warning',
$this->authUser->getModule()->getDisplayName(),
$this->requestedModule->getDisplayName()
$currentDisplayName,
$newDisplayName
) :
$this->msg( 'oathauth-disable-method-warning', $this->authUser->getModule()->getDisplayName() );
$this->msg( 'oathauth-disable-method-warning', $currentDisplayName );
$panel->appendContent( new HtmlSnippet(
$genericMessage->parseAsBlock()
@ -368,6 +370,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( [
@ -378,6 +388,10 @@ class OATHManage extends SpecialPage {
] );
$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()->addHTML( $panel->toString() );
}