From 6053a8079688ff5660e0a828e8d5c73a4b00eeab Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 27 Jul 2024 14:39:09 +0200 Subject: [PATCH] Added backend `/login` and `/register` routes. These are required for clients that don't have JS enabled and will get a 404 otherwise. The routes simply render `index.html`, which will be empty if JS is disabled and will redirect to the appropriate login/registration Vue route if the user isn't logged in. --- platypush/backend/http/app/routes/index.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/platypush/backend/http/app/routes/index.py b/platypush/backend/http/app/routes/index.py index 9b9a25dd4d..eedf1a64ae 100644 --- a/platypush/backend/http/app/routes/index.py +++ b/platypush/backend/http/app/routes/index.py @@ -14,8 +14,26 @@ __routes__ = [ @index.route('/') @authenticate() -def index(): - """ Route to the main web panel """ +def index_route(): + """Route to the main web panel""" + return render_template('index.html', utils=HttpUtils) + + +@index.route('/login', methods=['GET']) +def login_route(): + """ + Login GET route. It simply renders the index template, which will + redirect to the login page if the user is not authenticated. + """ + return render_template('index.html', utils=HttpUtils) + + +@index.route('/register', methods=['GET']) +def register_route(): + """ + Register GET route. It simply renders the index template, which will + redirect to the registration page if no users are present. + """ return render_template('index.html', utils=HttpUtils)