From: Marius Balteanu Date: Sat, 29 Jan 2022 09:43:46 +0000 (+0000) Subject: Improve readability of @must_activate_twofa?@ function (#31920). X-Git-Tag: 5.0.0~87 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=972edf78cc3e4eb02009cf78350b4a734a5c95cb;p=redmine.git Improve readability of @must_activate_twofa?@ function (#31920). git-svn-id: http://svn.redmine.org/redmine/trunk@21389 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/user.rb b/app/models/user.rb index 8c190374f..7cdfa1dbd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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