From 972edf78cc3e4eb02009cf78350b4a734a5c95cb Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Sat, 29 Jan 2022 09:43:46 +0000 Subject: [PATCH] Improve readability of @must_activate_twofa?@ function (#31920). git-svn-id: http://svn.redmine.org/redmine/trunk@21389 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/user.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 -- 2.39.5