Refactor authentication and session management
- Removed session-based user retrieval from dependencies.py and main.py. - Eliminated SessionMiddleware and related session handling code. - Updated dashboard and team views to directly query user data from the database. - Simplified redeem and team management views to remove authentication checks. - Adjusted templates to reflect changes in user context handling. - Added camera selection feature in scan_qr.html for improved QR code scanning. - Cleaned up Docker configuration and requirements for better deployment.
This commit is contained in:
@@ -62,37 +62,15 @@
|
||||
<a href="/dashboard" class="hover:text-golden-ale transition-colors duration-200">
|
||||
<i class="fas fa-tachometer-alt"></i> Dashboard
|
||||
</a>
|
||||
{% if current_user and current_user.is_admin %}
|
||||
<a href="/admin/" class="hover:text-golden-ale transition-colors duration-200">
|
||||
<i class="fas fa-lock"></i> Admin
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="/about" class="hover:text-golden-ale transition-colors duration-200">
|
||||
About
|
||||
</a>
|
||||
<a href="/contact" class="hover:text-golden-ale transition-colors duration-200">
|
||||
Contact
|
||||
</a>
|
||||
|
||||
<!-- User Authentication -->
|
||||
{% if current_user %}
|
||||
<div class="relative group">
|
||||
<button class="flex items-center focus:outline-none">
|
||||
<span class="mr-1">{{ current_user.username }}</span>
|
||||
<i class="fas fa-chevron-down text-xs"></i>
|
||||
</button>
|
||||
<div class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg overflow-hidden z-20 hidden group-hover:block">
|
||||
<a href="/auth/profile" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Profile</a>
|
||||
<a href="/dashboard/" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Dashboard</a>
|
||||
<div class="border-t border-gray-100"></div>
|
||||
<a href="/auth/logout" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<a href="/auth/login" class="bg-white text-irish-green px-4 py-1 rounded-md hover:bg-cream-white transition-colors duration-200">
|
||||
Log In
|
||||
</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
|
||||
<!-- Mobile Menu Button -->
|
||||
@@ -116,34 +94,15 @@
|
||||
<a href="/dashboard" class="hover:bg-green-800 py-2 px-3 rounded-md transition-colors duration-200">
|
||||
<i class="fas fa-tachometer-alt"></i> Dashboard
|
||||
</a>
|
||||
{% if current_user and current_user.is_admin %}
|
||||
<a href="/admin/" class="hover:bg-green-800 py-2 px-3 rounded-md transition-colors duration-200">
|
||||
<i class="fas fa-lock"></i> Admin
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="/about" class="hover:bg-green-800 py-2 px-3 rounded-md transition-colors duration-200">
|
||||
About
|
||||
</a>
|
||||
<a href="/contact" class="hover:bg-green-800 py-2 px-3 rounded-md transition-colors duration-200">
|
||||
Contact
|
||||
</a>
|
||||
|
||||
<!-- Mobile Auth Links -->
|
||||
{% if current_user %}
|
||||
<a href="/auth/profile" class="hover:bg-green-800 py-2 px-3 rounded-md transition-colors duration-200">
|
||||
<i class="fas fa-user"></i> {{ current_user.username }}
|
||||
</a>
|
||||
<a href="/auth/logout" class="hover:bg-green-800 py-2 px-3 rounded-md transition-colors duration-200">
|
||||
<i class="fas fa-sign-out-alt"></i> Logout
|
||||
</a>
|
||||
{% else %}
|
||||
<a href="/auth/login" class="bg-white text-irish-green py-2 px-3 rounded-md">
|
||||
Log In
|
||||
</a>
|
||||
<a href="/auth/register" class="border border-white text-white py-2 px-3 rounded-md">
|
||||
Sign Up
|
||||
</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user