#!/usr/bin/env python3 import hswro from os import environ def login_form(): print(" `!Login:`") print(f" Username: `BFFF`F000`<16|username`>{hswro.BGCOLOR}") print(f" Password: `BFFF`F000`{hswro.BGCOLOR}") print(" [`[Submit`:/page/login.mu`*]]") l = hswro.get_login_info() form_login = environ.get('field_username', None) form_pass = environ.get('field_pass', None) print("#!c=0") hswro.header() if l[1] is not None: print(f"`c`!Warning:`! {l[1]}") if form_pass is not None and not hswro.check_password(form_pass): print(f"`c`!Incorrect password.`!") if hswro.check_password(form_pass) and form_login is not None: e = hswro.login(form_login) if e is not None: print(f"`c`!Error:`! {e}") if l[0] is None: login_form() else: print(f"Welcome, {l[0]}.") hswro.footer()