TOTPEnableForm: Display enrollment timestamp with recovery tokens

Bug: T234004
Change-Id: Ic708552fffdd2260e2f270b484c28ca47a9f4c03
This commit is contained in:
Reedy 2024-01-08 19:22:51 +00:00
parent a0c70e1eaa
commit a8c58f56f4
3 changed files with 20 additions and 5 deletions

View file

@ -12,8 +12,10 @@
"oathauth-account": "Account name:",
"oathauth-secret": "Two-factor authentication secret key:",
"oathauth-enable": "Enable two-factor authentication",
"oathauth-recoverycodes": "The following list is a list of one-time use recovery codes. These codes can only be used once, and are for emergency use when you don't have access to your device. Please write these down and keep them in a secure location. It is recommended that you mark each code as used when you have logged in using it. If you lose your device, these codes are the only way to rescue your account.\n\n'''These codes will never be shown again'''.",
"oathauth-recoverycodes": "The following list is a list of one-time use recovery codes. These codes can only be used once, and are for emergency use when you don't have access to your device. Please write these down and keep them in a secure location. It is recommended that you mark each code as used when you have logged in using it. If you lose your device, these codes are the only way to rescue your account.",
"oathauth-recoverycodes-important": "This step is important! Do not skip this step!",
"oathauth-recoverycodes-neveragain": "These codes will never be shown again!",
"oathauth-recoverytokens-createdat": "Recovery tokens created: $1",
"oathauth-recoverycodes-download": "Download recovery codes",
"oathauth-disable": "Disable two-factor authentication",
"oathauth-validatedoath": "Validated two-factor credentials. Two-factor authentication will now be enforced.",

View file

@ -29,6 +29,8 @@
"oathauth-enable": "Page title on Special:OATH, when enabling OATH.\n\nSee [https://en.wikipedia.org/wiki/Two_factor_authentication two factor authentication]",
"oathauth-recoverycodes": "Plain text, found on Special:OATH while enabling OATH.",
"oathauth-recoverycodes-important": "Plain text, found on Special:OATH while enabling OATH.",
"oathauth-recoverycodes-neveragain": "Plain text, found on Special:OATH while enabling OATH.",
"oathauth-recoverytokens-createdat": "Plain text, found on Special:OATH while enabling OATH.",
"oathauth-recoverycodes-download": "Plain text, text of the download link on Special:OATH while enabling OATH.",
"oathauth-disable": "Page title on Special:OATH while disabling OATH.\n\nSee [https://en.wikipedia.org/wiki/Two_factor_authentication two factor authentication]",
"oathauth-validatedoath": "Plain text found on Special:OATH after a token has been validated.\n\nSee [https://en.wikipedia.org/wiki/Two_factor_authentication two factor authentication]",

View file

@ -68,6 +68,8 @@ class TOTPEnableForm extends OATHAuthOOUIHTMLForm {
->margin( 0 )
->build();
$now = wfTimestampNow();
// messages used: oathauth-step1, oathauth-step2, oathauth-step3, oathauth-step4
return [
'app' => [
@ -103,10 +105,19 @@ class TOTPEnableForm extends OATHAuthOOUIHTMLForm {
'scratchtokens' => [
'type' => 'info',
'default' =>
'<strong>' . $this->msg( 'oathauth-recoverycodes-important' )->escaped() . '</strong><br/>'
. $this->msg( 'oathauth-recoverycodes' )->parse()
. $this->createResourceList( $this->getScratchTokensForDisplay( $key ) )
. $this->createDownloadLink( $this->getScratchTokensForDisplay( $key ) ),
'<strong>' . $this->msg( 'oathauth-recoverycodes-important' )->escaped() . '</strong><br/>' .
$this->msg( 'oathauth-recoverycodes' )->escaped() . '<br/><br/>' .
$this->msg( 'rawmessage' )->rawParams(
$this->msg(
'oathauth-recoverytokens-createdat',
$this->getLanguage()->userTimeAndDate( $now, $this->oathUser->getUser() )
)->parse()
. $this->msg( 'word-separator' )->escaped()
. $this->msg( 'parentheses' )->rawParams( wfTimestamp( TS_ISO_8601, $now ) )->escaped()
) . '<br/>' .
$this->createResourceList( $this->getScratchTokensForDisplay( $key ) ) . '<br/>' .
'<strong>' . $this->msg( 'oathauth-recoverycodes-neveragain' )->escaped() . '</strong><br/>' .
$this->createDownloadLink( $this->getScratchTokensForDisplay( $key ) ),
'raw' => true,
'section' => 'step3',
],