From a61d81cc367a91c3694f52a135d506306e6c5e0e Mon Sep 17 00:00:00 2001 From: Christoph Loesch Date: Mon, 12 Apr 2021 02:34:38 +0200 Subject: [PATCH] complete rewrite to ldap --- index.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/index.py b/index.py index 1a7f8b2..3e20324 100755 --- a/index.py +++ b/index.py @@ -52,7 +52,7 @@ def main(): main_content = '' form = cgi.FieldStorage() - debug_content = str(form) + http_host = os.environ.get('HTTP_HOST') if 'submit' in form.keys(): formvars = ['accountname', 'oldpass', 'newpass', 'newpass2'] form_ok = check_form(formvars, form) @@ -84,7 +84,7 @@ def main(): if conn.simple_bind(accountname, newpass) == True: # We did it conn.unbind() - main_content = read_template_file('success.tpl') + main_content = read_template_file('success.tpl', http_host=http_host) else: conn.unbind() main_content = read_template_file('fail.tpl', message=cgi.escape(ldap.LDAPError)) @@ -100,12 +100,11 @@ def main(): formaction = cgi.escape("https://" + os.environ["HTTP_HOST"] + os.environ["REQUEST_URI"]) #accountname = os.environ.get('REMOTE_USER') accountname = os.environ.get('AUTHENTICATE_UID') - http_host = os.environ.get('HTTP_HOST') form = read_template_file('form.tpl', formaction=formaction, accountname=accountname, http_host=http_host) main_content = form response = generate_headers() + "\n" - response += read_template_file('main.tpl', main_content=main_content, debug_content=debug_content) + response += read_template_file('main.tpl', main_content=main_content) sys.stdout.buffer.write(response.encode('utf-8'))