From 2ad04860a310d166d42b6a93a1734a7ed22c4150 Mon Sep 17 00:00:00 2001 From: pika Date: Mon, 31 Mar 2025 17:31:30 +0200 Subject: [PATCH] wip --- app/routes/auth.py | 6 ++++-- app/routes/dashboard.py | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/routes/auth.py b/app/routes/auth.py index 8803b3c..6fab0a8 100644 --- a/app/routes/auth.py +++ b/app/routes/auth.py @@ -74,8 +74,10 @@ def register(): db.session.add(new_user) db.session.commit() - flash("Registration successful! You can now log in.", "success") - return redirect(url_for("auth.login")) + # Log the user in automatically + login_user(new_user) + flash("Registration successful! Welcome!", "success") + return redirect(url_for("dashboard.dashboard_home")) return render_template("auth/register.html", title="Register") diff --git a/app/routes/dashboard.py b/app/routes/dashboard.py index 6a23363..c8590c5 100644 --- a/app/routes/dashboard.py +++ b/app/routes/dashboard.py @@ -10,9 +10,13 @@ bp = Blueprint("dashboard", __name__, url_prefix="/dashboard") @bp.route("/") -@login_required def dashboard_home(): """Main dashboard view showing server statistics""" + # Check if user is logged in, redirect if not + if not current_user.is_authenticated: + flash("Please log in to access this page.", "info") + return redirect(url_for('auth.login')) + server_count = Server.query.count() app_count = App.query.count() subnet_count = Subnet.query.count()