File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,16 +69,12 @@ public function updateCMSFields(FieldList $fields)
6969 ));
7070 $ mfaGraceEnd ->addExtraClass ('mfa-settings__grace-period ' );
7171
72- $ mapFn = function ($ groups = []) {
73- $ map = [];
74- foreach ($ groups as $ group ) {
75- // Listboxfield values are escaped, use ASCII char instead of »
76- $ map [$ group ->ID ] = $ group ->getBreadcrumbs (' > ' );
77- }
78- asort ($ map );
79- return $ map ;
80- };
81- $ groupsMap = $ mapFn (Group::get ());
72+ $ groupsMap = [];
73+ foreach (Group::get () as $ group ) {
74+ // Listboxfield values are escaped, use ASCII char instead of »
75+ $ groupsMap [$ group ->ID ] = $ group ->getBreadcrumbs (' > ' );
76+ }
77+ asort ($ groupsMap );
8278
8379 $ mfaGroupRestrict = ListboxField::create (
8480 "MFAGroupRestrictions " ,
@@ -88,7 +84,8 @@ public function updateCMSFields(FieldList $fields)
8884 ->setAttribute (
8985 'data-placeholder ' ,
9086 _t (__CLASS__ . '.MFA_GROUP_RESTRICTIONS_PLACEHOLDER ' , 'Click to select group ' )
91- )->setDescription (_t (
87+ )
88+ ->setDescription (_t (
9289 __CLASS__ . '.MFA_GROUP_RESTRICTIONS_DESCRIPTION ' ,
9390 'MFA will only be enabled for members of these selected groups. ' .
9491 'If no groups are selected, MFA will be enabled for all users '
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ public function shouldRedirectToMFA(Member $member): bool
108108 return false ;
109109 }
110110
111- if (!$ this ->isUserInMFAEnabledGroup ($ member )) {
111+ if (!$ this ->isUserInMFAEnabledGroup ($ member ) && ! $ this -> hasCompletedRegistration ( $ member ) ) {
112112 return false ;
113113 }
114114
@@ -271,7 +271,7 @@ protected function isEnabled(): bool
271271 return true ;
272272 }
273273
274- protected function isUserInMFAEnabledGroup (Member $ member )
274+ protected function isUserInMFAEnabledGroup (Member $ member ): bool
275275 {
276276 /** @var SiteConfig&SiteConfigExtension $siteConfig */
277277 $ siteConfig = SiteConfig::current_site_config ();
Original file line number Diff line number Diff line change @@ -14,4 +14,4 @@ Feature: MFA is enabled for the site
1414 Then I should see "Multi-factor authentication (MFA)"
1515 When I select "MFA is required for everyone" from the MFA settings
1616 And I press "Save"
17- Then I should see "Saved"
17+ Then I should see a "Saved" success toast
You can’t perform that action at this time.
0 commit comments