Compare commits
No commits in common. "master" and "master" have entirely different histories.
10
app.py
10
app.py
|
@ -33,9 +33,10 @@ def post_index():
|
||||||
try:
|
try:
|
||||||
ldap_change_password(form('username'),
|
ldap_change_password(form('username'),
|
||||||
form('old-password'), form('new-password'))
|
form('old-password'), form('new-password'))
|
||||||
except Exception as exc:
|
except Error as e:
|
||||||
print(f"Unsuccessful attempt to change password for {form('username')}: {exc=}")
|
print("Unsuccessful attemp to change password for {}: {}"
|
||||||
return error(str(exc))
|
.format(form('username'), str(e)))
|
||||||
|
return error(str(e))
|
||||||
|
|
||||||
print("Password successfully changed for: {}"
|
print("Password successfully changed for: {}"
|
||||||
.format(form('username')))
|
.format(form('username')))
|
||||||
|
@ -57,8 +58,7 @@ def ldap_change_password(username, old, new):
|
||||||
l = ldap.initialize(CONF['ldap']['host'])
|
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_CACERTFILE, CONF['ldap']['tls_cacert'])
|
||||||
l.set_option(ldap.OPT_X_TLS, ldap.OPT_X_TLS_DEMAND)
|
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.simple_bind_s(dn_name, old)
|
||||||
l.passwd_s(dn_name, old, new)
|
l.passwd_s(dn_name, old, new)
|
||||||
l.unbind_s()
|
l.unbind_s()
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
[html]
|
[html]
|
||||||
page_title = Change your password on unit.abbiamoundominio.org
|
page_title = Change your password on unit.macaomilano.org
|
||||||
|
|
||||||
[ldap]
|
[ldap]
|
||||||
host = ldap://localhost:389
|
host = ldap://unit.macaomilano.org:389
|
||||||
base = ou=Hackers,dc=unit,dc=abbiamoundominio,dc=org
|
base = ou=Hackers,dc=unit,dc=macaomilano,dc=org
|
||||||
tls = True
|
|
||||||
tls_cacert = /etc/ssl/cert.pem
|
tls_cacert = /etc/ssl/cert.pem
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user