diff options
author | Daniel GarcĂa Moreno <danigm@soleta.eu> | 2021-06-01 11:43:02 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2021-06-01 18:25:41 +0200 |
commit | 3cfdfa3b12660a2e61801771e06f55348c7cf970 (patch) | |
tree | 61ed82d8c7309f338e1d96d9b4e12777075c6808 | |
parent | b2a0e96fbd6975d73b103d5100683e071864f3bd (diff) |
Redirect to login page by default
This patch redirects to the login page instead of showing an empty page
when the user is not logged in.
-rw-r--r-- | ogcp/views.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index d49391f..9865e0f 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -128,18 +128,18 @@ def image_modified_date_from_str(image): @app.route('/') def index(): - clients = None - if current_user.is_authenticated: - clients = get_clients() - images_response = g.server.get('/images') - images = images_response.json()['images'] - images.sort(key=image_modified_date_from_str, reverse=True) - disk = images_response.json()['disk'] - oglive_list = g.server.get('/oglive/list').json() - return render_template('dashboard.html', clients=clients, - images=images, disk=disk, - oglive_list=oglive_list) - return render_template('base.html') + if not current_user.is_authenticated: + return redirect(url_for('login')) + + clients = get_clients() + images_response = g.server.get('/images') + images = images_response.json()['images'] + images.sort(key=image_modified_date_from_str, reverse=True) + disk = images_response.json()['disk'] + oglive_list = g.server.get('/oglive/list').json() + return render_template('dashboard.html', clients=clients, + images=images, disk=disk, + oglive_list=oglive_list) @app.route('/login', methods=['GET', 'POST']) def login(): |