fix(2fa): fixed various typos
This commit is contained in:
parent
6b466e15b1
commit
45e456bdf0
3 changed files with 5 additions and 5 deletions
|
|
@ -48,16 +48,16 @@ class Test2FA(object):
|
|||
user = user_util.create_user(password=self.password)
|
||||
user.has_enabled_2fa = True
|
||||
user.init_secret_2fa()
|
||||
recovery_cod_to_check = user.init_2fa_recovery_codes()[0]
|
||||
recovery_code_to_check = user.init_2fa_recovery_codes()[0]
|
||||
Session().add(user)
|
||||
Session().commit()
|
||||
self.app.post(
|
||||
route_path('login'),
|
||||
{'username': user.username,
|
||||
'password': self.password})
|
||||
response = self.app.post(route_path('check_2fa'), {'totp': recovery_cod_to_check})
|
||||
response = self.app.post(route_path('check_2fa'), {'totp': recovery_code_to_check})
|
||||
assert response.status_code == 302
|
||||
response = self.app.post(route_path('check_2fa'), {'totp': recovery_cod_to_check})
|
||||
response = self.app.post(route_path('check_2fa'), {'totp': recovery_code_to_check})
|
||||
response.mustcontain('Code is invalid. Try again!')
|
||||
|
||||
def test_2fa_state_when_forced_by_admin(self, user_util):
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ class MyAccountView(BaseAppView, DataGridAppView):
|
|||
c.active = '2fa'
|
||||
user_instance = c.auth_user.get_instance()
|
||||
|
||||
state = self.request.POST.get('2fa_status') == '1'
|
||||
state = str2bool(self.request.POST.get('2fa_status'))
|
||||
user_instance.has_enabled_2fa = state
|
||||
user_instance.update_userdata(update_2fa=time.time())
|
||||
Session().commit()
|
||||
|
|
|
|||
|
|
@ -813,7 +813,7 @@ class User(Base, BaseModel):
|
|||
Checks if 2fa was forced for ALL users (including current one)
|
||||
"""
|
||||
from rhodecode.model.settings import SettingsModel
|
||||
# So now we're supporting only auth_rhodecode_global_2f
|
||||
# So now we're supporting only auth_rhodecode_global_2fa
|
||||
if value := SettingsModel().get_setting_by_name('auth_rhodecode_global_2fa'):
|
||||
return value.app_settings_value
|
||||
return False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue