This commit is contained in:
Aitzol 2023-11-24 20:25:35 +01:00
parent 92bc2bbdbf
commit a53f2aa274
6 changed files with 58 additions and 21 deletions

View File

@ -16,10 +16,7 @@
<h1>{{ str['2fa-title'] }}</h1> <h1>{{ str['2fa-title'] }}</h1>
% if data['secureAuth'] == True: % if data['secureAuth'] == True:
<div class="info"> <div class="info">{{ str['2fa-info-1'] }}</div>
Aurrerantzean ondorengo kodea erabili beharko duzu saioa hasteko. Mugikorrerako OTP edo 2FA aplikazioa baten
bidez QR kodea irakurtzean jasoko duzun gakoa baliatuz horretarako.
</div>
<div class="qr-code"> <div class="qr-code">
<img src="{{'static/tmp/'+data['authToken']+'.png'}}" /> <img src="{{'static/tmp/'+data['authToken']+'.png'}}" />
@ -37,10 +34,7 @@
</form> </form>
% else: % else:
<div class="info"> <div class="info">{{ str['2fa-info-2'] }}</div>
Bi urratseko autentifikazioa segurtasun gehigarri bat da. Hau gaituz saio hasieran erabiltzaile eta pasahitzaz
gain QR bidez jasoko duzun gako bat eskatuko zaizu.
</div>
<form name="enable2faForm" method="post" action="/enable_2fa"> <form name="enable2faForm" method="post" action="/enable_2fa">
<!--<input id="token" name="token" type="text" value="{{data['authToken']}}" readonly>--> <!--<input id="token" name="token" type="text" value="{{data['authToken']}}" readonly>-->

4
app.py
View File

@ -822,7 +822,6 @@ def add_auth_attribute_step3(conf, username, code, action):
#set current LDAP #set current LDAP
superUser = SuperUsers(conf) superUser = SuperUsers(conf)
print(action)
with connect_ldap(conf, user=superUser.admin_dn, password=superUser.admin_pwd) as c: with connect_ldap(conf, user=superUser.admin_dn, password=superUser.admin_pwd) as c:
user_dn = find_user_dn(conf, c, username) user_dn = find_user_dn(conf, c, username)
if(action == 'enable'): if(action == 'enable'):
@ -1080,7 +1079,7 @@ def is_trusted_device(conf, user_dn):
c.unbind() c.unbind()
return True return True
except Exception as e: except Exception as e:
print(e) LOG.warning(e)
return True return True
def update_login_info(conf, user_dn): def update_login_info(conf, user_dn):
@ -1127,7 +1126,6 @@ def newSession():
return CONF['locale']['lang'] return CONF['locale']['lang']
def get(self): def get(self):
print(self.data)
if 'username' in self.data: if 'username' in self.data:
return(self.data) return(self.data)
else: else:

Binary file not shown.

View File

@ -129,6 +129,30 @@ msgstr "Devices"
msgid "show" msgid "show"
msgstr "show" msgstr "show"
#: libs/localization.py:43
msgid "Two factor authentication"
msgstr "Two factor authentication"
#: libs/localization.py:44
msgid "Token"
msgstr "Token"
#: libs/localization.py:45
msgid "Disable"
msgstr "Disable"
#: libs/localization.py:46
msgid "Enable"
msgstr "Enable"
#: libs/localization.py:47
msgid "You must then use the following code to log in. Using the key you will receive by reading the QR code via a OTP or 2FA mobile app."
msgstr "You must then use the following code to log in. Using the key you will receive by reading the QR code via a OTP or 2FA mobile app."
#: libs/localization.py:48
msgid "Two factor authentication is additional security. By enabling this you will be asked at the login, in addition to the user and password, a key you will receive by QR."
msgstr "Two factor authentication is additional security. By enabling this you will be asked at the login, in addition to the user and password, a key you will receive by QR."
#: libs/localization.py:45 #: libs/localization.py:45
msgid "The session was closed." msgid "The session was closed."
msgstr "The session was closed." msgstr "The session was closed."

Binary file not shown.

View File

@ -8,14 +8,14 @@ msgstr ""
"Project-Id-Version: 0.0.1\n" "Project-Id-Version: 0.0.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-04-07 17:23+0200\n" "POT-Creation-Date: 2022-04-07 17:23+0200\n"
"PO-Revision-Date: 2023-04-07 13:27+0200\n" "PO-Revision-Date: 2023-11-24 20:21+0100\n"
"Last-Translator: Aitzol Berasategi <aitzol@lainoa.eus>\n" "Last-Translator: Aitzol Berasategi <aitzol@lainoa.eus>\n"
"Language-Team: LANGUAGE <EU@eu.org>\n" "Language-Team: LANGUAGE <EU@eu.org>\n"
"Language: eu\n" "Language: eu\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3\n" "X-Generator: Poedit 3.2.2\n"
#: libs/localization.py:15 #: libs/localization.py:15
msgid "User" msgid "User"
@ -129,6 +129,32 @@ msgstr "Gailuak"
msgid "show" msgid "show"
msgstr "ikusi" msgstr "ikusi"
#: libs/localization.py:43
msgid "Two factor authentication"
msgstr "Bi urratseko autentifikazioa"
#: libs/localization.py:44
msgid "Token"
msgstr "Gakoa"
#: libs/localization.py:45
msgid "Disable"
msgstr "Desgaitu"
#: libs/localization.py:46
msgid "Enable"
msgstr "Gaitu"
#: libs/localization.py:47
msgid "You must then use the following code to log in. Using the key you will receive by reading the QR code via a OTP or 2FA mobile app."
msgstr ""
"Aurrerantzean ondorengo kodea erabili beharko duzu saioa hasteko. Mugikorrerako OTP edo 2FA aplikazio baten bidez QR kodea irakurtzean jasoko duzun gakoa baliatuz "
"horretarako."
#: libs/localization.py:48
msgid "Two factor authentication is additional security. By enabling this you will be asked at the login, in addition to the user and password, a key you will receive by QR."
msgstr "Bi urratseko autentifikazioa segurtasun gehigarri bat da. Hau gaituz saio hasieran erabiltzaile eta pasahitzaz gain QR bidez jasoko duzun gako bat eskatuko zaizu."
#: libs/localization.py:45 #: libs/localization.py:45
msgid "The session was closed." msgid "The session was closed."
msgstr "Saioa itxi da." msgstr "Saioa itxi da."
@ -158,12 +184,8 @@ msgid "Passwords do not match!"
msgstr "Pasahitzak ez datoz bat!" msgstr "Pasahitzak ez datoz bat!"
#: libs/localization.py:53 #: libs/localization.py:53
msgid "" msgid "The password must contain at least 8 characters, at least one number, a capital letter and a special character."
"The password must contain at least 8 characters, at least one number, " msgstr "Pasahitzak gutxienez 8 karaktere izan behar ditu, zenbaki bat, hizki larri bat eta karaktere berezi bat."
"a capital letter and a special character."
msgstr ""
"Pasahitzak gutxienez 8 karaktere izan behar ditu, zenbaki bat, hizki larri bat "
"eta karaktere berezi bat."
#: libs/localization.py:54 #: libs/localization.py:54
msgid "Congratulations, your account has been created!" msgid "Congratulations, your account has been created!"
@ -222,8 +244,7 @@ msgid "Unable to connect to the remote server."
msgstr "Ezinezkoa urruneko zerbitzara konektatzea." msgstr "Ezinezkoa urruneko zerbitzara konektatzea."
#: libs/localization.py:68 #: libs/localization.py:68
msgid "" msgid "Encountered an unexpected error while communicating with the remote server."
"Encountered an unexpected error while communicating with the remote server."
msgstr "Ezusteko errore bat gertatu da urruneko zerbitzariarekin komunikatzean." msgstr "Ezusteko errore bat gertatu da urruneko zerbitzariarekin komunikatzean."
#: libs/localization.py:69 #: libs/localization.py:69