##// END OF EJS Templates
fix(2fa): fixed various typos
super-admin -
r5377:1ab522cf default
parent child Browse files
Show More
@@ -48,16 +48,16 b' class Test2FA(object):'
48 48 user = user_util.create_user(password=self.password)
49 49 user.has_enabled_2fa = True
50 50 user.init_secret_2fa()
51 recovery_cod_to_check = user.init_2fa_recovery_codes()[0]
51 recovery_code_to_check = user.init_2fa_recovery_codes()[0]
52 52 Session().add(user)
53 53 Session().commit()
54 54 self.app.post(
55 55 route_path('login'),
56 56 {'username': user.username,
57 57 'password': self.password})
58 response = self.app.post(route_path('check_2fa'), {'totp': recovery_cod_to_check})
58 response = self.app.post(route_path('check_2fa'), {'totp': recovery_code_to_check})
59 59 assert response.status_code == 302
60 response = self.app.post(route_path('check_2fa'), {'totp': recovery_cod_to_check})
60 response = self.app.post(route_path('check_2fa'), {'totp': recovery_code_to_check})
61 61 response.mustcontain('Code is invalid. Try again!')
62 62
63 63 def test_2fa_state_when_forced_by_admin(self, user_util):
@@ -226,7 +226,7 b' class MyAccountView(BaseAppView, DataGri'
226 226 c.active = '2fa'
227 227 user_instance = c.auth_user.get_instance()
228 228
229 state = self.request.POST.get('2fa_status') == '1'
229 state = str2bool(self.request.POST.get('2fa_status'))
230 230 user_instance.has_enabled_2fa = state
231 231 user_instance.update_userdata(update_2fa=time.time())
232 232 Session().commit()
@@ -813,7 +813,7 b' class User(Base, BaseModel):'
813 813 Checks if 2fa was forced for ALL users (including current one)
814 814 """
815 815 from rhodecode.model.settings import SettingsModel
816 # So now we're supporting only auth_rhodecode_global_2f
816 # So now we're supporting only auth_rhodecode_global_2fa
817 817 if value := SettingsModel().get_setting_by_name('auth_rhodecode_global_2fa'):
818 818 return value.app_settings_value
819 819 return False
General Comments 0
You need to be logged in to leave comments. Login now