Compare commits

..

No commits in common. "master" and "master" have entirely different histories.

2 changed files with 8 additions and 9 deletions

10
app.py
View File

@ -33,9 +33,10 @@ def post_index():
try:
ldap_change_password(form('username'),
form('old-password'), form('new-password'))
except Exception as exc:
print(f"Unsuccessful attempt to change password for {form('username')}: {exc=}")
return error(str(exc))
except Error as e:
print("Unsuccessful attemp to change password for {}: {}"
.format(form('username'), str(e)))
return error(str(e))
print("Password successfully changed for: {}"
.format(form('username')))
@ -57,8 +58,7 @@ def ldap_change_password(username, old, new):
l = ldap.initialize(CONF['ldap']['host'])
l.set_option(ldap.OPT_X_TLS_CACERTFILE, CONF['ldap']['tls_cacert'])
l.set_option(ldap.OPT_X_TLS, ldap.OPT_X_TLS_DEMAND)
if CONF['ldap']['tls'] == "True":
l.start_tls_s()
l.start_tls_s()
l.simple_bind_s(dn_name, old)
l.passwd_s(dn_name, old, new)
l.unbind_s()

View File

@ -1,10 +1,9 @@
[html]
page_title = Change your password on unit.abbiamoundominio.org
page_title = Change your password on unit.macaomilano.org
[ldap]
host = ldap://localhost:389
base = ou=Hackers,dc=unit,dc=abbiamoundominio,dc=org
tls = True
host = ldap://unit.macaomilano.org:389
base = ou=Hackers,dc=unit,dc=macaomilano,dc=org
tls_cacert = /etc/ssl/cert.pem
[server]