forked from unit/ldap-panel
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f6429b4ea3 | ||
|
0dcdabe339 | ||
|
7a3d365928 |
10
app.py
10
app.py
|
@ -33,10 +33,9 @@ def post_index():
|
|||
try:
|
||||
ldap_change_password(form('username'),
|
||||
form('old-password'), form('new-password'))
|
||||
except Error as e:
|
||||
print("Unsuccessful attemp to change password for {}: {}"
|
||||
.format(form('username'), str(e)))
|
||||
return error(str(e))
|
||||
except Exception as exc:
|
||||
print(f"Unsuccessful attempt to change password for {form('username')}: {exc=}")
|
||||
return error(str(exc))
|
||||
|
||||
print("Password successfully changed for: {}"
|
||||
.format(form('username')))
|
||||
|
@ -58,7 +57,8 @@ 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)
|
||||
l.start_tls_s()
|
||||
if CONF['ldap']['tls'] == "True":
|
||||
l.start_tls_s()
|
||||
l.simple_bind_s(dn_name, old)
|
||||
l.passwd_s(dn_name, old, new)
|
||||
l.unbind_s()
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
[html]
|
||||
page_title = Change your password on unit.macaomilano.org
|
||||
page_title = Change your password on unit.abbiamoundominio.org
|
||||
|
||||
[ldap]
|
||||
host = ldap://unit.macaomilano.org:389
|
||||
base = ou=Hackers,dc=unit,dc=macaomilano,dc=org
|
||||
host = ldap://localhost:389
|
||||
base = ou=Hackers,dc=unit,dc=abbiamoundominio,dc=org
|
||||
tls = True
|
||||
tls_cacert = /etc/ssl/cert.pem
|
||||
|
||||
[server]
|
||||
|
|
Loading…
Reference in New Issue
Block a user