]> source.dussan.org Git - redmine.git/commitdiff
Improve readability of @must_activate_twofa?@ function (#31920).
authorMarius Balteanu <marius.balteanu@zitec.com>
Sat, 29 Jan 2022 09:43:46 +0000 (09:43 +0000)
committerMarius Balteanu <marius.balteanu@zitec.com>
Sat, 29 Jan 2022 09:43:46 +0000 (09:43 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@21389 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/user.rb

index 8c190374fd540c34dd66a27ad1219651010a9968..7cdfa1dbdf7533874659880eaffad7383d2caeeb 100644 (file)
@@ -384,10 +384,10 @@ class User < Principal
   end
 
   def must_activate_twofa?
-    (
-      Setting.twofa_required? ||
-      (Setting.twofa_optional? && groups.any?(&:twofa_required?))
-    ) && !twofa_active?
+    return false if twofa_active?
+
+    return true if Setting.twofa_required?
+    return true if Setting.twofa_optional? && groups.any?(&:twofa_required?)
   end
 
   def pref