# HG changeset patch # User Serhii Ilin # Date 2024-05-16 13:01:22 # Node ID 6efbb976bce1f544ba9fb8a5fce8ca98ff57d944 # Parent 46138ab97e37957943682514c5b3d8483c0f8110 fix(forced 2fa): fixed forced 2fa functionality. Fixes: RCCE-68 diff --git a/rhodecode/apps/_base/__init__.py b/rhodecode/apps/_base/__init__.py --- a/rhodecode/apps/_base/__init__.py +++ b/rhodecode/apps/_base/__init__.py @@ -182,6 +182,8 @@ class BaseAppView(object): "warning", ignore_duplicate=False, ) + # Special case for users created "on the fly" (ldap case for new user) + user_obj.check_2fa_required = False raise HTTPFound(self.request.route_path(self.SETUP_2FA_VIEW)) def _maybe_needs_2fa_check(self, view_name, user_obj): diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -813,7 +813,7 @@ class User(Base, BaseModel): Checks if 2fa was forced for current user """ from rhodecode.model.settings import SettingsModel - if value := SettingsModel().get_setting_by_name(f'{self.extern_type}_global_2fa'): + if value := SettingsModel().get_setting_by_name(f'auth_{self.extern_type}_global_2fa'): return value.app_settings_value return False