diff --git a/public/admin/tool/mfa/classes/local/form/login_form.php b/public/admin/tool/mfa/classes/local/form/login_form.php index 6658db43b5a..8ebe3177acc 100644 --- a/public/admin/tool/mfa/classes/local/form/login_form.php +++ b/public/admin/tool/mfa/classes/local/form/login_form.php @@ -88,7 +88,12 @@ class login_form extends \moodleform { $this->globalmanager->definition_after_data($mform); $buttonarray = []; - $buttonarray[] = &$mform->createElement('submit', 'submitbutton', get_string('loginsubmit', 'factor_' . $factor->name)); + $buttonarray[] = &$mform->createElement( + 'submit', + 'submitbutton', + get_string('loginsubmit', 'factor_' . $factor->name), + ['class' => 'tool-mfa-verify-submit w-100'], + ); $mform->addGroup($buttonarray, 'buttonar', '', [' '], false); $mform->closeHeaderBefore('buttonar'); } diff --git a/public/admin/tool/mfa/classes/local/form/verification_field.php b/public/admin/tool/mfa/classes/local/form/verification_field.php index d11abc50ebf..5c9a622947a 100644 --- a/public/admin/tool/mfa/classes/local/form/verification_field.php +++ b/public/admin/tool/mfa/classes/local/form/verification_field.php @@ -53,7 +53,7 @@ class verification_field extends \MoodleQuickForm_text { $attributes['inputmode'] = 'numeric'; $attributes['pattern'] = '[0-9]*'; // Overwrite default classes if set. - $attributes['class'] = isset($attributes['class']) ? $attributes['class'] : 'tool-mfa-verification-code fw-bold'; + $attributes['class'] = isset($attributes['class']) ? $attributes['class'] : 'tool-mfa-verification-code'; $attributes['maxlength'] = 6; // If we aren't on the auth page, this might be part of a larger form such as for setup. diff --git a/public/admin/tool/mfa/classes/output/renderer.php b/public/admin/tool/mfa/classes/output/renderer.php index ffdd789ede2..aef658338f3 100644 --- a/public/admin/tool/mfa/classes/output/renderer.php +++ b/public/admin/tool/mfa/classes/output/renderer.php @@ -640,7 +640,6 @@ class renderer extends \plugin_renderer_base { if ($loginfactor->name != $factor->name) { $additionalfactor = [ 'name' => $loginfactor->name, - 'icon' => $loginfactor->get_icon(), 'loginoption' => get_string('loginoption', 'factor_' . $loginfactor->name), ]; // We mark the factor as disabled if it is locked. @@ -687,9 +686,8 @@ class renderer extends \plugin_renderer_base { } $context = [ - 'logintitle' => get_string('logintitle', 'factor_'.$factor->name), + 'logintitle' => get_string('logintitle', 'tool_mfa'), 'logindesc' => $factor->get_login_desc(), - 'factoricon' => $factor->get_icon(), 'form' => $form->render(), 'hasadditionalfactors' => $hasadditionalfactors, 'additionalfactors' => $alladitionalfactors, diff --git a/public/admin/tool/mfa/factor/email/lang/en/deprecated.txt b/public/admin/tool/mfa/factor/email/lang/en/deprecated.txt new file mode 100644 index 00000000000..4a3b3bd582b --- /dev/null +++ b/public/admin/tool/mfa/factor/email/lang/en/deprecated.txt @@ -0,0 +1 @@ +logintitle,factor_email diff --git a/public/admin/tool/mfa/factor/email/lang/en/factor_email.php b/public/admin/tool/mfa/factor/email/lang/en/factor_email.php index 3f7ab594b30..d3f68ba77fb 100644 --- a/public/admin/tool/mfa/factor/email/lang/en/factor_email.php +++ b/public/admin/tool/mfa/factor/email/lang/en/factor_email.php @@ -44,11 +44,10 @@ $string['error:parameters'] = 'Incorrect page parameters.'; $string['error:wrongverification'] = 'Wrong code. Try again.'; $string['event:unauthemail'] = 'Unauthorised email received'; $string['info'] = 'You are using email {$a} to authenticate. This has been set up by your site administrator.'; -$string['logindesc'] = 'We\'ve just sent a 6-digit code to your email: {$a}'; -$string['loginoption'] = 'Have a code emailed to you'; +$string['logindesc'] = 'To keep your account safe, we need to check that it\'s really you. We\'ve sent a code to {$a}. Please enter the code below to continue.'; +$string['loginoption'] = 'Receive code via email'; $string['loginskip'] = "I didn't receive a code"; $string['loginsubmit'] = 'Continue'; -$string['logintitle'] = "Verify it's you by email"; $string['managefactor'] = 'Manage email'; $string['manageinfo'] = '\'{$a}\' is being used to authenticate. This has been set up by your administrator.'; $string['pluginname'] = 'Email'; @@ -66,3 +65,6 @@ IP {$a->ip} with browser agent {$a->useragent}.'; $string['unauthemail'] = 'Unauthorised email'; $string['verificationcode'] = 'Enter verification code for confirmation'; $string['verificationcode_help'] = 'A verification code has been sent to your email.'; + +// Deprecated since Moodle 5.2. +$string['logintitle'] = "Verify it's you by email"; diff --git a/public/admin/tool/mfa/factor/sms/lang/en/deprecated.txt b/public/admin/tool/mfa/factor/sms/lang/en/deprecated.txt index a169d428b21..89308ec2db7 100644 --- a/public/admin/tool/mfa/factor/sms/lang/en/deprecated.txt +++ b/public/admin/tool/mfa/factor/sms/lang/en/deprecated.txt @@ -13,3 +13,4 @@ settings:gateway_help,factor_sms errorawsconection,factor_sms event:smssentdescription,factor_sms event:smssent,factor_sms +logintitle,factor_sms diff --git a/public/admin/tool/mfa/factor/sms/lang/en/factor_sms.php b/public/admin/tool/mfa/factor/sms/lang/en/factor_sms.php index 6840f844fe3..85d63386788 100644 --- a/public/admin/tool/mfa/factor/sms/lang/en/factor_sms.php +++ b/public/admin/tool/mfa/factor/sms/lang/en/factor_sms.php @@ -34,8 +34,8 @@ $string['error:emptyverification'] = 'Empty code. Try again.'; $string['error:wrongphonenumber'] = 'The phone number you provided is not in a valid format.'; $string['error:wrongverification'] = 'Wrong code. Try again.'; $string['info'] = 'Have a verification code sent to the mobile number you choose.'; -$string['logindesc'] = 'SMS message containing a 6-digit code sent to mobile number {$a}'; -$string['loginoption'] = 'Have a code sent to your mobile phone'; +$string['logindesc'] = 'To keep your account safe, we need to check that it\'s really you. We\'ve sent a code to {$a}. Please enter the code below to continue.'; +$string['loginoption'] = 'Receive code via SMS'; $string['loginskip'] = "I didn't receive a code"; $string['loginsubmit'] = 'Continue'; $string['managefactor'] = 'Manage SMS'; @@ -43,7 +43,6 @@ $string['managefactorbutton'] = 'Manage'; $string['manageinfo'] = 'You are using \'{$a}\' to authenticate.'; $string['notification:smsgatewaymigration'] = 'SMS settings have moved'; $string['notification:smsgatewaymigrationinfo'] = 'A new SMS subsystem is now available for managing and configuring all SMS-related functions. Your existing SMS configurations have been migrated to the page SMS gateways.'; -$string['logintitle'] = 'Enter the verification code sent to your mobile'; $string['phonehelp'] = 'Enter your mobile number (including country code) to receive a verification code.'; $string['pluginname'] = 'SMS'; $string['privacy:metadata'] = 'The SMS factor plugin does not store any personal data.'; @@ -84,3 +83,6 @@ $string['settings:gateway_help'] = 'The SMS provider you wish to send messages v $string['errorawsconection'] = 'Error connecting to AWS server: {$a}'; $string['event:smssentdescription'] = 'The user with ID {$a->userid} was sent a verification code via SMS. Information: {$a->debuginfo}'; $string['event:smssent'] = 'SMS message sent.'; + +// Deprecated since Moodle 5.2. +$string['logintitle'] = 'Enter the verification code sent to your mobile'; diff --git a/public/admin/tool/mfa/factor/sms/tests/behat/factor_sms_login.feature b/public/admin/tool/mfa/factor/sms/tests/behat/factor_sms_login.feature index b63d1eea616..4eddf1f7cad 100644 --- a/public/admin/tool/mfa/factor/sms/tests/behat/factor_sms_login.feature +++ b/public/admin/tool/mfa/factor/sms/tests/behat/factor_sms_login.feature @@ -35,7 +35,7 @@ Feature: Login user with sms authentication factor Scenario: Login user successfully with sms verification Given I log out And I log in as "admin" - And I should see "2-step verification" + And I should see "We need to verify your identity" And I should see "Enter code" When I set the field "Enter code" with valid code And I click on "Continue" "button" @@ -44,7 +44,7 @@ Feature: Login user with sms authentication factor Scenario: Wrong code number end of possible attempts Given I log out And I log in as "admin" - And I should see "2-step verification" + And I should see "We need to verify your identity" And I should see "Enter code" When I set the field "Enter code" to "555556" And I click on "Continue" "button" diff --git a/public/admin/tool/mfa/factor/totp/lang/en/deprecated.txt b/public/admin/tool/mfa/factor/totp/lang/en/deprecated.txt new file mode 100644 index 00000000000..89a8e540241 --- /dev/null +++ b/public/admin/tool/mfa/factor/totp/lang/en/deprecated.txt @@ -0,0 +1 @@ +logintitle,factor_totp diff --git a/public/admin/tool/mfa/factor/totp/lang/en/factor_totp.php b/public/admin/tool/mfa/factor/totp/lang/en/factor_totp.php index 1e3a7ea8c66..470d791619f 100644 --- a/public/admin/tool/mfa/factor/totp/lang/en/factor_totp.php +++ b/public/admin/tool/mfa/factor/totp/lang/en/factor_totp.php @@ -38,11 +38,10 @@ $string['error:oldcode'] = 'This code is too old. Please verify the time on your $string['error:wrongverification'] = 'Incorrect verification code.'; $string['factorsetup'] = 'App setup'; $string['info'] = 'Generate a verification code using an authenticator app.'; -$string['logindesc'] = 'Use the authenticator app in your mobile device to generate a code.'; -$string['loginoption'] = 'Use Authenticator application'; +$string['logindesc'] = 'To keep your account safe, we need to check that it\'s really you. Click continue to use your authenticator app.'; +$string['loginoption'] = 'Receive code via authenticator app'; $string['loginskip'] = 'I don\'t have my device'; $string['loginsubmit'] = 'Continue'; -$string['logintitle'] = 'Verify it\'s you by mobile app'; $string['managefactor'] = 'Manage authenticator app'; $string['managefactorbutton'] = 'Manage'; $string['manageinfo'] = 'You are using \'{$a}\' to authenticate.'; @@ -83,3 +82,6 @@ $string['summarycondition'] = 'using a TOTP app'; $string['systimeformat'] = '%l:%M:%S %P %Z'; $string['verificationcode'] = 'Enter your 6 digit verification code'; $string['verificationcode_help'] = 'Open your authenticator app such as Google Authenticator and look for the 6 digit code which matches this site and username'; + +// Deprecated since Moodle 5.2. +$string['logintitle'] = 'Verify it\'s you by mobile app'; diff --git a/public/admin/tool/mfa/factor/webauthn/lang/en/deprecated.txt b/public/admin/tool/mfa/factor/webauthn/lang/en/deprecated.txt new file mode 100644 index 00000000000..a7a00319c57 --- /dev/null +++ b/public/admin/tool/mfa/factor/webauthn/lang/en/deprecated.txt @@ -0,0 +1 @@ +logintitle,factor_webauthn diff --git a/public/admin/tool/mfa/factor/webauthn/lang/en/factor_webauthn.php b/public/admin/tool/mfa/factor/webauthn/lang/en/factor_webauthn.php index b8ef3c6d9b5..11d6d68e3ff 100644 --- a/public/admin/tool/mfa/factor/webauthn/lang/en/factor_webauthn.php +++ b/public/admin/tool/mfa/factor/webauthn/lang/en/factor_webauthn.php @@ -34,11 +34,10 @@ $string['authenticatorname'] = 'Security key name'; $string['error'] = 'Failed to authenticate'; $string['error:alreadyregistered'] = 'This security key secret has already been registered.'; $string['info'] = 'Use a physical security key or fingerprint scanner.'; -$string['logindesc'] = 'Click continue to use your security key.'; -$string['loginoption'] = 'Use security key'; +$string['logindesc'] = 'To keep your account safe, we need to check that it\'s really you. Click continue to use your security key.'; +$string['loginoption'] = 'Verify via security key'; $string['loginskip'] = 'I don\'t have my security key'; $string['loginsubmit'] = 'Continue'; -$string['logintitle'] = 'Verify it\'s you by security key'; $string['pluginname'] = 'Security key'; $string['privacy:metadata'] = 'The Security key factor plugin does not store any personal data.'; $string['register'] = 'Register security key'; @@ -68,3 +67,6 @@ $string['manageinfo'] = 'You are using \'{$a}\' to authenticate.'; $string['userverification:discouraged'] = 'User verification should not be employed, for example to minimize user interaction'; $string['userverification:preferred'] = 'User verification is preferred, authentication will not fail if user verification is missing'; $string['userverification:required'] = 'User verification is required (e.g. by pin). Authentication fails if key does not have user verification'; + +// Deprecated since Moodle 5.2. +$string['logintitle'] = 'Verify it\'s you by security key'; diff --git a/public/admin/tool/mfa/lang/en/deprecated.txt b/public/admin/tool/mfa/lang/en/deprecated.txt index 29b847cd2db..b215e78b071 100644 --- a/public/admin/tool/mfa/lang/en/deprecated.txt +++ b/public/admin/tool/mfa/lang/en/deprecated.txt @@ -1,2 +1,6 @@ inputrequired,tool_mfa setuprequired,tool_mfa +cancellogin,tool_mfa +verification,tool_mfa +verification_desc,tool_mfa +verifyalt,tool_mfa diff --git a/public/admin/tool/mfa/lang/en/tool_mfa.php b/public/admin/tool/mfa/lang/en/tool_mfa.php index 1f0ebc52484..99acb17ff2e 100644 --- a/public/admin/tool/mfa/lang/en/tool_mfa.php +++ b/public/admin/tool/mfa/lang/en/tool_mfa.php @@ -29,7 +29,7 @@ $string['achievedweight'] = 'Achieved weight'; $string['added'] = 'Added'; $string['alltime'] = 'All time'; $string['areyousure'] = 'Are you sure you want to remove this factor?'; -$string['cancellogin'] = 'Cancel login'; +$string['backtologin'] = 'Back to Log in'; $string['combination'] = 'Combination'; $string['confirmationreplace'] = 'You will be immediately required to set up another \'{$a}\'. Please make sure you are ready to complete the setup process.'; $string['confirmationrevoke'] = 'You will no longer be able to use \'{$a}\' to log in to this site.'; @@ -73,6 +73,7 @@ $string['fallback_info'] = 'This factor is a fallback if no other factors are co $string['guidance'] = 'Multi-factor authentication user guide'; $string['ipatcreation'] = 'IP address when factor created'; $string['lastused'] = 'Last used'; +$string['logintitle'] = 'We need to verify your identity'; $string['locked'] = '{$a} (Unavailable)'; $string['lockedusersforallfactors'] = 'Locked users: All factors'; $string['lockedusersforfactor'] = 'Locked users: {$a}'; @@ -165,11 +166,8 @@ $string['userempty'] = 'User cannot be empty.'; $string['userlogs'] = 'User logs'; $string['usernotfound'] = 'Unable to locate user.'; $string['usersauthedinperiod'] = 'Logged in'; -$string['verification'] = '2-step verification'; -$string['verification_desc'] = 'To keep your account safe, we need to check that this is really you.'; $string['verificationcode'] = 'Verification code'; $string['verificationcode_help'] = 'The verification code provided by the current authentication factor.'; -$string['verifyalt'] = 'Try another way to verify:'; $string['weight'] = 'Weight'; $string['yesremove'] = 'Yes, remove'; $string['yesreplace'] = 'Yes, replace'; @@ -177,3 +175,9 @@ $string['yesreplace'] = 'Yes, replace'; // Deprecated since Moodle 5.0. $string['inputrequired'] = 'User input'; $string['setuprequired'] = 'User setup'; + +// Deprecated since Moodle 5.2. +$string['cancellogin'] = 'Cancel login'; +$string['verification'] = '2-step verification'; +$string['verification_desc'] = 'To keep your account safe, we need to check that this is really you.'; +$string['verifyalt'] = 'Try another way to verify:'; diff --git a/public/admin/tool/mfa/styles.css b/public/admin/tool/mfa/styles.css index 2a376f12b12..75eef5e3338 100644 --- a/public/admin/tool/mfa/styles.css +++ b/public/admin/tool/mfa/styles.css @@ -1,36 +1,12 @@ input.tool-mfa-verification-code, .tool-mfa-verification-code input { - /* Some elements must be important to override form element*/ - font-size: 1.5em !important; /* stylelint-disable-line declaration-no-important */ font-family: monospace; text-align: center; letter-spacing: 1.0em; font-weight: bold; -} - -.tool-mfa-factor-choose, -.tool-mfa-factor-choose:hover { - background-color: #fff; - border-color: #3584c9; - border-width: 1px; - width: 100%; - border-radius: 0.5rem; -} - -.tool-mfa-factor-choose:hover, -.tool-mfa-factor-choose:hover .tool-mfa-factor-choose-text { - text-decoration: underline; - color: #094478; - background-color: #cfe2f2; -} - -.mfa-verify-form input[type="submit"] { - height: 50px; - font-size: 1.05rem; -} - -.mfa-verify-form .invalid-feedback { - font-weight: 700; + margin-top: 0.25rem; + background-color: #e9ecef; + border-color: #6a737b; } .mfa-verify-form .form-group.fitem, @@ -38,3 +14,27 @@ input.tool-mfa-verification-code, .mfa-verify-form .form-group.fitem > span > input { width: 100%; } + +input.tool-mfa-verify-submit, +.tool-mfa-verify-submit input { + width: 100%; + margin-top: 1rem; +} + +@media (max-width: 991.98px) { + .tool-mfa-verify-container { + padding-right: 16px; + padding-left: 16px; + } + + .login-layout-right-content:has(.tool-mfa-verify-container) { + margin-top: 0; + } +} + +@media (max-width: 767.98px) { + .tool-mfa-verify-container .mfa-verify-form { + margin-right: -16px; + margin-left: -16px; + } +} diff --git a/public/admin/tool/mfa/templates/verification_form.mustache b/public/admin/tool/mfa/templates/verification_form.mustache index fbea838b977..e710957bc4f 100644 --- a/public/admin/tool/mfa/templates/verification_form.mustache +++ b/public/admin/tool/mfa/templates/verification_form.mustache @@ -21,78 +21,60 @@ Example context (json): { - "logintitle": "We've just sent a 6-digit code to your email", + "logintitle": "We need to verify your identity", "logindesc": "Use the Google Authenticator app to generate a code.", - "factoricon": "fa-envelope", "form": "
", "hasadditionalfactors": true, "additionalfactors": [ { "name": "webauthn", - "icon": "fa-hand-pointer", "loginoption": "Use authenticator token" } ], "authurl": "https:\/\/webserver\/admin\/tool\/mfa\/auth.php", - "supportlink": "Contact site support<\/a>", + "supportlink": "Contact your site support<\/a>", "disablefactor": false } }} -{{#str}} verification_desc, tool_mfa {{/str}}
-{{{logindesc}}}
{{#str}} verifyalt, tool_mfa {{/str}}
-{{/hasadditionalfactors}} -{{#additionalfactors}} -