From 03e9743abb27c8f2a3f2921c7657bd20c7f019a1 Mon Sep 17 00:00:00 2001 From: Andy Pack Date: Thu, 10 Oct 2024 23:45:22 +0100 Subject: [PATCH] tightening frontend --- music/auth/auth.py | 2 +- music/music.py | 12 ++- music/templates/app.html | 6 +- music/templates/base.html | 4 +- music/templates/index.html | 123 ++++++++++----------- music/templates/login.html | 24 +++-- src/js/MusicTools.js | 14 ++- src/scss/style.scss | 213 ++++++++++++++----------------------- 8 files changed, 173 insertions(+), 225 deletions(-) diff --git a/music/auth/auth.py b/music/auth/auth.py index c7ddb6e..9193308 100644 --- a/music/auth/auth.py +++ b/music/auth/auth.py @@ -60,7 +60,7 @@ def login(): logger.info(f'success {username}') session['username'] = username - return redirect(url_for('app_route')) + return redirect(url_for('app_route_redirect')) else: logger.warning(f'failed attempt {username}') flash('incorrect password') diff --git a/music/music.py b/music/music.py index f44fafe..f9a417e 100644 --- a/music/music.py +++ b/music/music.py @@ -38,7 +38,7 @@ def create_app(): if 'username' in session: logged_in = True - return redirect(url_for('app_route')) + return redirect('/app/playlists') else: logged_in = False @@ -48,7 +48,15 @@ def create_app(): def privacy(): return render_template('privacy.html', bucket=STATIC_BUCKET) - @app.route('/app', defaults={'path': ''}) + @app.route('/app') + def app_route_redirect(): + + if 'username' not in session: + flash('please log in') + return redirect(url_for('index')) + + return redirect('/app/playlists') + @app.route('/app/') def app_route(path): diff --git a/music/templates/app.html b/music/templates/app.html index aa90691..29293d2 100644 --- a/music/templates/app.html +++ b/music/templates/app.html @@ -15,9 +15,6 @@ -
-

Mixonomer

-
{% with messages = get_flashed_messages() %} {% if messages %} @@ -29,9 +26,8 @@ {% endif %} {% endwith %} -

-
+
toast
diff --git a/music/templates/base.html b/music/templates/base.html index 09807d3..c0894e6 100644 --- a/music/templates/base.html +++ b/music/templates/base.html @@ -18,8 +18,8 @@ -
-

Mixonomer

+
+

Mixonomer