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.
This commit is contained in:
Fabio Manganiello 2024-07-27 14:39:09 +02:00
parent ccc778e056
commit 6053a80796
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -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)