Implement user authentication system with custom user model, views, and templates
- Created custom User model extending Django's AbstractUser. - Added user registration, login, and profile views with corresponding templates. - Implemented user authentication functionality and integrated Bootstrap for styling. - Updated project settings to use the new accounts app and user model. - Added tests for user model and admin functionality.
This commit is contained in:
parent
432d2b7707
commit
faddc4c9b0
22 changed files with 556 additions and 24 deletions
|
|
@ -4,7 +4,7 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}Twitch Drops Tracker{% endblock %}</title>
|
||||
<title>{% block title %}ttvdrops{% endblock %}</title>
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- FontAwesome -->
|
||||
|
|
@ -81,11 +81,43 @@
|
|||
<i class="fas fa-gamepad me-1"></i> Games
|
||||
</a>
|
||||
</li>
|
||||
{% if user.is_authenticated %}
|
||||
{% if user.is_staff %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'admin:index' %}">
|
||||
<i class="fas fa-cog me-1"></i> Admin
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
|
||||
data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fas fa-user me-1"></i> {{ user.username }}
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
|
||||
<li><a class="dropdown-item" href="{% url 'accounts:profile' %}">
|
||||
<i class="fas fa-user-circle me-2"></i> Profile
|
||||
</a></li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li><a class="dropdown-item" href="{% url 'accounts:logout' %}">
|
||||
<i class="fas fa-sign-out-alt me-2"></i> Logout
|
||||
</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'accounts:login' %}">
|
||||
<i class="fas fa-sign-in-alt me-1"></i> Login
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'accounts:signup' %}">
|
||||
<i class="fas fa-user-plus me-1"></i> Sign Up
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue