Refactor user authentication and dashboard features

- Added `is_admin` field to User model for role management.
- Updated user context middleware to include current user in templates.
- Enhanced session management with improved debug middleware.
- Refactored dashboard view to fetch user-specific data and recent events.
- Improved login and registration templates for better user experience.
- Added admin routes with access control for admin users.
- Updated Docker configuration for better error logging and dependency management.
- Updated requirements to include new dependencies and specify versions.
This commit is contained in:
Christian Krakau-Louis
2025-04-13 18:49:27 +02:00
parent 0de2eb5830
commit 4a79c5cacb
20 changed files with 790 additions and 579 deletions
+25 -17
View File
@@ -5,24 +5,25 @@
<h1 class="text-2xl font-bold text-irish-green mb-6 text-center">Log In</h1>
<!-- Messages/Alerts -->
{% if messages %}
{% for message in messages %}
<div class="mb-4 p-3 rounded {% if message.type == 'error' %}bg-red-100 text-red-700{% else %}bg-green-100 text-green-700{% endif %}">
{{ message.text }}
</div>
{% endfor %}
{% if error %}
<div class="mb-4 p-3 rounded bg-red-100 text-red-700">
{{ error }}
</div>
{% endif %}
<form action="/auth/login" method="post" class="space-y-4">
<input type="hidden" name="next" value="{{ next }}">
{% if message %}
<div class="mb-4 p-3 rounded bg-green-100 text-green-700">
{{ message }}
</div>
{% endif %}
<form action="/auth/login" method="post" class="space-y-4">
<div>
<label for="username" class="block text-sm font-medium text-gray-700 mb-1">Username or Email</label>
<label for="username" class="block text-sm font-medium text-gray-700 mb-1">Username</label>
<input
type="text"
id="username"
name="username"
value="{{ username or '' }}"
required
class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-irish-green focus:border-irish-green"
>
@@ -62,10 +63,6 @@
Log In
</button>
</div>
<div class="text-center text-sm mt-4">
<a href="/auth/forgot-password" class="text-irish-green hover:text-opacity-80">Forgot password?</a>
</div>
</form>
<div class="mt-6 pt-6 border-t border-gray-200 text-center">
@@ -75,7 +72,17 @@
</a>
</div>
<!-- OAuth login options (to be implemented later) -->
<!-- OAuth login options -->
{% if show_oauth %}
<div class="mt-6 pt-6 border-t border-gray-200">
<p class="text-center text-gray-600 mb-4">Or sign in with</p>
<div class="flex justify-center">
<a href="/auth/oauth-login" class="bg-blue-600 text-white py-2 px-4 rounded-md hover:bg-opacity-90 transition w-full flex items-center justify-center">
<i class="fas fa-sign-in-alt mr-2"></i> {{ oauth_provider_name }}
</a>
</div>
</div>
{% else %}
<div class="mt-6 pt-6 border-t border-gray-200">
<p class="text-center text-gray-600 mb-4">Or sign in with</p>
<div class="flex justify-center space-x-4">
@@ -86,8 +93,9 @@
<i class="fab fa-github mr-2"></i> GitHub
</button>
</div>
<p class="text-center text-gray-500 text-xs mt-2">OAuth login coming soon</p>
<p class="text-center text-gray-500 text-xs mt-2">OAuth login currently disabled</p>
</div>
{% endif %}
</div>
</div>
{% endblock %}