diff --git a/_2fa.tpl b/_2fa.tpl index 742f071..5df3b3c 100644 --- a/_2fa.tpl +++ b/_2fa.tpl @@ -17,7 +17,6 @@ % if data['secureAuth'] == True:
{{ str['2fa-info-1'] }}
-
diff --git a/app.py b/app.py index 675464e..0c2a310 100644 --- a/app.py +++ b/app.py @@ -169,8 +169,10 @@ def post_user(): logout(form('username')) return index_tpl(two_factor_authentication=True, path=data_to_url, str=i18n.str) except Error as e: - LOG.warning("Erabiltzailea ez da aurkitu???") - + #On error force disable 2fa + add_auth_attribute_step1(form('username'), None, action='disable') + LOG.debug("Two factor authentication has been impossible.") + return error(i18n.msg[29]) return user_tpl(alerts=[('success', '%s %s' % (i18n.msg[1], form('username').capitalize()), 'fadeOut' )], data=newSession().get(), str=i18n.str) @post('/user/') @@ -255,7 +257,7 @@ def post_signup(): return error(i18n.msg[15]) if not tools.pwd_validation(form('password')): - return error(i18n.msg[8]) #mezua ALDATU egin behar da + return error(i18n.msg[8]) elif form('password') != form('confirm-password'): return error(i18n.msg[7]) @@ -345,12 +347,12 @@ def post_enable_2fa(): except Error as e: reload(newSession().get()['username'], None, None) LOG.warning(e) - return error('2 urratseko autentifikazioa birgaitua izan da.') + return error(i18n.msg[30]) except Error as e: LOG.warning(e) return index_tpl(alerts=[('error', e, 'fadeOut')], str=i18n.str) - return _2fa_tpl(alerts=[('success', 'Bikain, 2 urratseko autentifikazioa gaitu da.', 'fadeOut')], data=newSession().get(), str=i18n.str) + return _2fa_tpl(alerts=[('success', i18n.msg[31], 'fadeOut')], data=newSession().get(), str=i18n.str) @post('/disable_2fa') def post_disable_2fa(): @@ -371,7 +373,7 @@ def post_disable_2fa(): LOG.warning(e) return index_tpl(alerts=[('error', e, 'fadeOut')], str=i18n.str) - return _2fa_tpl(alerts=[('error', '2 urratseko autentifikazioa desgaitua izan da.', 'fadeOut')], data=newSession().get(), str=i18n.str) + return _2fa_tpl(alerts=[('error', i18n.msg[32], 'fadeOut')], data=newSession().get(), str=i18n.str) @post('/change_pwd') def post_change_pwd(): @@ -476,7 +478,7 @@ def connect_ldap(conf, **kwargs): @error(404) @error(405) -def error404(error): +def error40x(error): return index_tpl(str=i18n.str) #LOGIN @@ -812,7 +814,7 @@ def add_auth_attribute_step2(conf, *args): except LDAPNoSuchAttributeResult as e: LOG.error('{}: {!s}'.format(e.__class__.__name__, e)) - raise Error('Dagoeneko desgaiturik zeneukan 2 urratseko autentifikazioa.') + raise Error(i18n.msg[33]) except LDAPExceptionError as e: LOG.error('{}: {!s}'.format(e.__class__.__name__, e)) @@ -1111,8 +1113,6 @@ def newSession(): def __init__(self): super(Session, self).__init__() self.data = bottle.request.environ.get('beaker.session') - #self.id = None - #self.lang = self.get_lang() #localization self.lang = self.get_lang() global i18n diff --git a/libs/localization.py b/libs/localization.py index a47b0db..6223fe0 100644 --- a/libs/localization.py +++ b/libs/localization.py @@ -78,6 +78,12 @@ class LocalizeTo(object): msg_27 = _("The session has expired.") msg_28 = _("Registration is currently closed. We apologize for the inconvenience.") + msg_29 = _("Two factor authentication has been impossible.") + msg_30 = _("Two factor authentication has been restored.") + msg_31 = _("Two factor authentication has been enabled.") + msg_32 = _("Two factor authentication has been disabled.") + msg_33 = _("Two factor authentication was already disabled.") + self.str = {'usr':str_00, 'usrn':str_01, 'fn':str_02, 'sn':str_03, 'pwd':str_04, 'old-pwd':str_05, 'new-pwd':str_06, 'conf-pwd':str_07, 'email':str_08, 'edit':str_09, 'login':str_10, 'log-out':str_11, 'del':str_12, 'sign-up':str_13, 'back':str_14, 'update':str_15, 'or-sign-in':str_16, @@ -85,4 +91,6 @@ class LocalizeTo(object): 'del-account':str_22, 'welcome':str_23, 'logs':str_24, 'last-login':str_25, 'devices':str_26, 'show':str_27, '2fa-title':str_28, 'token':str_29, 'disable':str_30, 'enable':str_31, '2fa-info-1':str_32, '2fa-info-2':str_33, 'pwd-pattern': msg_08} - self.msg = (msg_00, msg_01, msg_02, msg_03, msg_04, msg_05, msg_06, msg_07, msg_08, msg_09, msg_10, msg_11, msg_12, msg_13, msg_14, msg_15, msg_16, msg_17, msg_18, msg_19, msg_20, msg_21, msg_22, msg_23, msg_24, msg_25, msg_26, msg_27, msg_28) + self.msg = (msg_00, msg_01, msg_02, msg_03, msg_04, msg_05, msg_06, msg_07, msg_08, msg_09, msg_10, msg_11, + msg_12, msg_13, msg_14, msg_15, msg_16, msg_17, msg_18, msg_19, msg_20, msg_21, msg_22, msg_23, + msg_24, msg_25, msg_26, msg_27, msg_28, msg_29, msg_30, msg_31, msg_32, msg_33) diff --git a/locales/base.pot b/locales/base.pot index 892c2d4..7db3f29 100644 --- a/locales/base.pot +++ b/locales/base.pot @@ -270,3 +270,23 @@ msgstr "The session has expired." #: libs/localization.py:73 msgid "Registration is currently closed. We apologize for the inconvenience." msgstr "Registration is currently closed. We apologize for the inconvenience." + +#: libs/localization.py: +msgid "Two factor authentication has been impossible." +msgstr "Two factor authentication has been impossible." + +#: libs/localization.py: +msgid "Two factor authentication has been restored." +msgstr "Two factor authentication has been restored." + +#: libs/localization.py: +msgid "Two factor authentication has been enabled." +msgstr "Two factor authentication has been enabled." + +#: libs/localization.py: +msgid "Two factor authentication has been disabled." +msgstr "Two factor authentication has been disabled." + +#: libs/localization.py: +msgid "Two factor authentication was already disabled." +msgstr "Two factor authentication was already disabled." diff --git a/locales/en/LC_MESSAGES/base.mo b/locales/en/LC_MESSAGES/base.mo index a013ee6..649bb38 100644 Binary files a/locales/en/LC_MESSAGES/base.mo and b/locales/en/LC_MESSAGES/base.mo differ diff --git a/locales/en/LC_MESSAGES/base.po b/locales/en/LC_MESSAGES/base.po index 82ef3c4..12412c7 100644 --- a/locales/en/LC_MESSAGES/base.po +++ b/locales/en/LC_MESSAGES/base.po @@ -270,3 +270,23 @@ msgstr "The session has expired." #: libs/localization.py:73 msgid "Registration is currently closed. We apologize for the inconvenience." msgstr "Registration is currently closed. We apologize for the inconvenience." + +#: libs/localization.py: +msgid "Two factor authentication has been impossible." +msgstr "Two factor authentication has been impossible." + +#: libs/localization.py: +msgid "Two factor authentication has been restored." +msgstr "Two factor authentication has been restored." + +#: libs/localization.py: +msgid "Two factor authentication has been enabled." +msgstr "Two factor authentication has been enabled." + +#: libs/localization.py: +msgid "Two factor authentication has been disabled." +msgstr "Two factor authentication has been disabled." + +#: libs/localization.py: +msgid "Two factor authentication was already disabled." +msgstr "Two factor authentication was already disabled." diff --git a/locales/eu/LC_MESSAGES/base.mo b/locales/eu/LC_MESSAGES/base.mo index a63c688..2dafaf1 100644 Binary files a/locales/eu/LC_MESSAGES/base.mo and b/locales/eu/LC_MESSAGES/base.mo differ diff --git a/locales/eu/LC_MESSAGES/base.po b/locales/eu/LC_MESSAGES/base.po index 3a70da0..0dd208e 100644 --- a/locales/eu/LC_MESSAGES/base.po +++ b/locales/eu/LC_MESSAGES/base.po @@ -266,3 +266,23 @@ msgstr "Saioa iraungi egin da." #: libs/localization.py:73 msgid "Registration is currently closed. We apologize for the inconvenience." msgstr "Izen-ematea itxita dago une honetan. Barkatu eragozpenak." + +#: libs/localization.py: +msgid "Two factor authentication has been impossible." +msgstr "Ezinezkoa izan da bi urratseko autentifikazioa burutzea." + +#: libs/localization.py: +msgid "Two factor authentication has been restored." +msgstr "Bi urratseko autentifikazioa birgaitua izan da." + +#: libs/localization.py: +msgid "Two factor authentication has been enabled." +msgstr "Bi urratseko autentifikazioa gaitua izan da." + +#: libs/localization.py: +msgid "Two factor authentication has been disabled." +msgstr "Bi urratseko autentifikazioa desgaitua izan da." + +#: libs/localization.py: +msgid "Two factor authentication was already disabled." +msgstr "Bi urratseko autentifikazioa desgaiturik zegoen." diff --git a/user.tpl b/user.tpl index 9737fa8..f2063ee 100644 --- a/user.tpl +++ b/user.tpl @@ -55,7 +55,7 @@