From 18074bdf61a603b229a3cfc37beef10f56660c00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Wed, 24 May 2023 15:31:30 +0200 Subject: [PATCH] Improve print view of MFA backup codes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - Add a “Print” button. - Only show the codes + an explanatory text by moving it in front of all other elements in the print style. see https://www.woltlab.com/community/thread/290079-ausdrucken-von-mfa-notfallcodes-erleichtern/ --- .../templates/multifactorManageBackup.tpl | 36 ++++++++++++++----- .../files/style/ui/accountSecurity.scss | 23 ++++++++++++ wcfsetup/install/lang/de.xml | 2 ++ wcfsetup/install/lang/en.xml | 2 ++ 4 files changed, 54 insertions(+), 9 deletions(-) diff --git a/com.woltlab.wcf/templates/multifactorManageBackup.tpl b/com.woltlab.wcf/templates/multifactorManageBackup.tpl index 15c3642d88..9312a2fd50 100644 --- a/com.woltlab.wcf/templates/multifactorManageBackup.tpl +++ b/com.woltlab.wcf/templates/multifactorManageBackup.tpl @@ -1,9 +1,27 @@ -{if !$isUnveiled}{lang}wcf.user.security.multifactor.backup.existingCodes.description{/lang}{/if} -
    -{foreach from=$codes item='code'} -
  1. - {foreach from=$code[chunks] item='chunk'}{$chunk}{/foreach} - {if $code[useTime]}({$code[useTime]|plainTime}){/if} -
  2. -{/foreach} -
+
+ {if $isUnveiled} + {lang}wcf.user.security.multifactor.backup.printMetadata{/lang} + {else} + {lang}wcf.user.security.multifactor.backup.existingCodes.description{/lang} + {/if} + +
    + {foreach from=$codes item='code'} +
  1. + {foreach from=$code[chunks] item='chunk'}{$chunk}{/foreach} + {if $code[useTime]}({$code[useTime]|plainTime}){/if} +
  2. + {/foreach} +
+ + {if $isUnveiled} + + {/if} +
diff --git a/wcfsetup/install/files/style/ui/accountSecurity.scss b/wcfsetup/install/files/style/ui/accountSecurity.scss index 98bcf51add..e4e1b35cf5 100644 --- a/wcfsetup/install/files/style/ui/accountSecurity.scss +++ b/wcfsetup/install/files/style/ui/accountSecurity.scss @@ -45,6 +45,29 @@ } } +@media not print { + .multifactorBackupCodesPrintMetadata { + display: none !important; + } +} + +@media print { + .multifactorBackupCodesPrintButton { + display: none !important; + } + + .multifactorBackupCodesPrintContainer { + padding: 1cm !important; + position: absolute !important; + background: white !important; + inset: 0 !important; + + .multifactorBackupCodesPrintMetadata { + max-width: 9cm !important; + } + } +} + // Just .multifactorTotpCode is not specific enough. input.multifactorTotpCode, input.multifactorEmailCode, diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 8ccb059ab6..5f30e36c34 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -4960,6 +4960,8 @@ Die E-Mail-Adresse des neuen Benutzers lautet: {@$user->email}. Nachfolgend {if LANGUAGE_USE_INFORMAL_VARIANT}findest du{else}finden Sie{/if} den zuletzt generierten Satz an Notfallcodes für die Mehrfaktor-Authentifizierung. Durchgestrichene Notfallcodes wurden bereits verwendet und sind nicht mehr gültig. {if LANGUAGE_USE_INFORMAL_VARIANT}Verwende{else}Verwenden Sie{/if} die fettgedruckte Nummer, um die Notfallcodes mit {if LANGUAGE_USE_INFORMAL_VARIANT}deinen{else}Ihren{/if} Notizen abzugleichen. {if LANGUAGE_USE_INFORMAL_VARIANT}Generiere neue Codes, falls deine Notizen{else}Generieren Sie neue Codes, falls Ihre Notizen{/if} nicht zu der angezeigten Liste passen.

]]>
+ Notfallcodes für {$__wcf->user->username} auf {PAGE_TITLE|phrase} generiert am {time time=TIME_NOW type='plainTime'}.

]]>
+ {if LANGUAGE_USE_INFORMAL_VARIANT}Generiere{else}Generieren Sie{/if} neue Notfallcodes, wenn {if LANGUAGE_USE_INFORMAL_VARIANT}du deinen{else}Sie Ihren{/if} bisherigen Satz verlegt oder verbraucht {if LANGUAGE_USE_INFORMAL_VARIANT}hast{else}haben{/if}. Die Generierung neuer Notfallcodes wird alle bestehenden Notfallcodes ungültig machen.

]]>
diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index ee62e79888..437b64f532 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -4962,6 +4962,8 @@ You can manage multi-factor authentication within the Account Security page [URL You can find the latest set of emergency codes for use with the multi-factor authentication below. Codes that are striked out have been used and are no longer valid. Use the bold identifier to compare the list to your notes. Please generate a new set of codes if the listed codes do not match your notes.

]]>
+ Emergency Codes for {$__wcf->user->username} on {PAGE_TITLE|phrase} generated at {time time=TIME_NOW type='plainTime'}.

]]>
+ Generate new emergency codes if you lost or used up your existing set. Generating new emergency codes will invalidate all existing codes.

]]>
-- 2.20.1