diff --git a/master/main.py b/master/main.py index ad3a760..e3b4243 100644 --- a/master/main.py +++ b/master/main.py @@ -462,18 +462,25 @@ def admin(): @app.route('/login', methods=['POST']) def login(): - if request.method == 'POST': - # Handle login - print('Login attempt', flush=True) - password = request.form['password'] - if os.getenv('ADMIN_KEY') == password: - # Generate login key - login_key = os.urandom(32).hex() - logins.append(login_key) - # Set cookie - resp = make_response(redirect('/admin')) - resp.set_cookie('login_key', login_key) - return resp + # Handle login + print('Login attempt', flush=True) + password = request.form['password'] + print('Password: ' + password, flush=True) + if os.getenv('ADMIN_KEY') == password: + print('Login success', flush=True) + # Generate login key + login_key = os.urandom(32).hex() + logins.append(login_key) + # Set cookie + resp = make_response(redirect('/admin')) + resp.set_cookie('login_key', login_key) + return resp + print('Login failed', flush=True) + return redirect('/failed-login') + +@app.route('/failed-login') +def failed_login(): + return "

Failed login


"