Fix BuildError for non-existent dashboard routes after login
After successful login, the app tried to redirect to admin.dashboard or dashboard.list routes that don't exist yet (Phase 5 & 6). Changes: - Login now redirects to index page for all users - Logout redirects to index page instead of submission.form - Base template navigation shows "Coming in Phase X" messages instead of broken links to unimplemented routes - Added TODO comments for future dashboard implementation This allows login/logout to work properly in MVP (Phase 3) while dashboard features are pending implementation. Bug: werkzeug.routing.exceptions.BuildError: Could not build url for endpoint 'admin.dashboard' 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+8
-6
@@ -28,11 +28,13 @@ def login():
|
|||||||
login_user(user)
|
login_user(user)
|
||||||
flash(f'Welcome back, {user.username}!', 'success')
|
flash(f'Welcome back, {user.username}!', 'success')
|
||||||
|
|
||||||
# Redirect based on role
|
# TODO: Redirect based on role when dashboards are implemented
|
||||||
if user.role == 'administrator':
|
# For now, redirect to index page
|
||||||
return redirect(url_for('admin.dashboard'))
|
# if user.role == 'administrator':
|
||||||
elif user.role == 'product_owner':
|
# return redirect(url_for('admin.dashboard'))
|
||||||
return redirect(url_for('dashboard.list'))
|
# elif user.role == 'product_owner':
|
||||||
|
# return redirect(url_for('dashboard.list'))
|
||||||
|
return redirect(url_for('index'))
|
||||||
else:
|
else:
|
||||||
flash('Invalid username or password', 'error')
|
flash('Invalid username or password', 'error')
|
||||||
|
|
||||||
@@ -45,4 +47,4 @@ def logout():
|
|||||||
"""User logout"""
|
"""User logout"""
|
||||||
logout_user()
|
logout_user()
|
||||||
flash('You have been logged out', 'info')
|
flash('You have been logged out', 'info')
|
||||||
return redirect(url_for('submission.form'))
|
return redirect(url_for('index'))
|
||||||
|
|||||||
@@ -189,13 +189,11 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
{% if current_user and current_user.is_authenticated %}
|
{% if current_user and current_user.is_authenticated %}
|
||||||
<div class="nav">
|
<div class="nav">
|
||||||
|
<a href="{{ url_for('index') }}">Home</a>
|
||||||
{% if current_user.role == 'product_owner' %}
|
{% if current_user.role == 'product_owner' %}
|
||||||
<a href="{{ url_for('dashboard.list') }}">Dashboard</a>
|
<span style="color: #999;">(Dashboard - Coming in Phase 5)</span>
|
||||||
<a href="{{ url_for('dashboard.products') }}">Products</a>
|
|
||||||
{% elif current_user.role == 'administrator' %}
|
{% elif current_user.role == 'administrator' %}
|
||||||
<a href="{{ url_for('admin.dashboard') }}">Admin Dashboard</a>
|
<span style="color: #999;">(Admin Panel - Coming in Phase 6)</span>
|
||||||
<a href="{{ url_for('admin.users') }}">Users</a>
|
|
||||||
<a href="{{ url_for('admin.products') }}">Products</a>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{{ url_for('auth.logout') }}" style="float: right;">Logout ({{ current_user.username }})</a>
|
<a href="{{ url_for('auth.logout') }}" style="float: right;">Logout ({{ current_user.username }})</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user