diff --git a/routes/__pycache__/auth.cpython-313.pyc b/routes/__pycache__/auth.cpython-313.pyc index 135c1e4..cc0be2c 100644 Binary files a/routes/__pycache__/auth.cpython-313.pyc and b/routes/__pycache__/auth.cpython-313.pyc differ diff --git a/routes/__pycache__/main.cpython-313.pyc b/routes/__pycache__/main.cpython-313.pyc index 477f0cb..307d185 100644 Binary files a/routes/__pycache__/main.cpython-313.pyc and b/routes/__pycache__/main.cpython-313.pyc differ diff --git a/routes/auth.py b/routes/auth.py index f6c96d4..ba06704 100644 --- a/routes/auth.py +++ b/routes/auth.py @@ -20,6 +20,9 @@ def init_routes(auth_bp): return redirect(url_for('auth.login')) login_user(user, remember=remember) + next_page = request.args.get('next') + if next_page: + return redirect(next_page) return redirect(url_for('main.dashboard')) return render_template('auth/login.html') @@ -50,8 +53,8 @@ def init_routes(auth_bp): db.session.add(new_user) db.session.commit() - flash('Registration successful! Please login.', 'success') - return redirect(url_for('auth.login')) + login_user(new_user) + return redirect(url_for('main.dashboard')) return render_template('auth/register.html') @@ -59,4 +62,4 @@ def init_routes(auth_bp): @login_required def logout(): logout_user() - return redirect(url_for('main.home')) \ No newline at end of file + return redirect(url_for('auth.login')) \ No newline at end of file diff --git a/routes/main.py b/routes/main.py index 240863e..59641f9 100644 --- a/routes/main.py +++ b/routes/main.py @@ -27,9 +27,9 @@ def init_routes(main_bp): @main_bp.route('/') def home(): - if current_user.is_authenticated: - return redirect(url_for('main.dashboard')) - return render_template('home.html') + if not current_user.is_authenticated: + return redirect(url_for('auth.login')) + return redirect(url_for('main.dashboard')) @main_bp.route('/dashboard') @login_required diff --git a/templates/auth/login.html b/templates/auth/login.html index c0445d4..87b24b8 100644 --- a/templates/auth/login.html +++ b/templates/auth/login.html @@ -7,13 +7,53 @@ + + +
-

Welcome Back

+

Welcome Back

Sign in to your account

@@ -21,7 +61,10 @@ {% if messages %} {% for category, message in messages %} {% if category in ['error', 'danger', 'login'] %} -
{{ message }}
+
+ {{ message }} +
{% endif %} {% endfor %} {% endif %} @@ -30,23 +73,28 @@
- +
- +
- +
- +
- -
-

Don't have an account? Register

-