File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -812,9 +812,10 @@ public static function possible_factor_setup() {
812
812
}
813
813
814
814
/**
815
- * Gets current user weight, up until first unknown factor.
815
+ * Gets current user weight
816
+ * @param bool $stoponunknown if true, will stop on the first unknown facotr.
816
817
*/
817
- public static function get_cumulative_weight () {
818
+ public static function get_cumulative_weight ($ stoponunknown = true ) {
818
819
$ factors = \tool_mfa \plugininfo \factor::get_active_user_factor_types ();
819
820
$ totalweight = 0 ;
820
821
foreach ($ factors as $ factor ) {
@@ -824,7 +825,7 @@ public static function get_cumulative_weight() {
824
825
if ($ totalweight >= 100 ) {
825
826
break ;
826
827
}
827
- } else if ($ factor ->get_state () == \tool_mfa \plugininfo \factor::STATE_UNKNOWN ) {
828
+ } else if ($ stoponunknown && $ factor ->get_state () == \tool_mfa \plugininfo \factor::STATE_UNKNOWN ) {
828
829
break ;
829
830
}
830
831
}
Original file line number Diff line number Diff line change @@ -135,7 +135,9 @@ public function get_state($redirectable = true) {
135
135
}
136
136
137
137
// We should never redirect if we have already passed.
138
- if ($ redirectable && \tool_mfa \manager::get_cumulative_weight () >= 100 ) {
138
+ // Do not stop on unknown, to avoid factors e.g. login banner from
139
+ // hiding passing factors lower down in the list.
140
+ if ($ redirectable && \tool_mfa \manager::get_cumulative_weight (false ) >= 100 ) {
139
141
$ redirectable = false ;
140
142
}
141
143
You can’t perform that action at this time.
0 commit comments