login button

online_registration
Raz 11 months ago
parent d402330501
commit c70deac834
  1. 14
      tournaments/forms.py
  2. 32
      tournaments/static/tournaments/css/style.css
  3. 18
      tournaments/templates/profile.html
  4. 5
      tournaments/templates/tournaments/base.html
  5. 1
      tournaments/templates/tournaments/navigation_base.html
  6. 9
      tournaments/templates/tournaments/navigation_tournament.html
  7. 3
      tournaments/templates/tournaments/tournament_info.html
  8. 4
      tournaments/views.py

@ -140,6 +140,11 @@ class CustomPasswordResetForm(PasswordResetForm):
send_mail(subject, message, None, [user.email])
class ProfileUpdateForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Remove autofocus from the 'username' field
self.fields['username'].widget.attrs.pop("autofocus", None)
class Meta:
model = CustomUser
fields = ['first_name', 'last_name', 'licence_id', 'username', 'email', 'phone']
@ -151,3 +156,12 @@ class ProfileUpdateForm(forms.ModelForm):
'last_name': 'Nom de famille',
'licence_id': 'Numéro de licence',
}
from django.contrib.auth.forms import PasswordChangeForm
class CustomPasswordChangeForm(PasswordChangeForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Remove autofocus from all fields in the PasswordChangeForm
for field in self.fields.values():
field.widget.attrs.pop("autofocus", None)

@ -725,3 +725,35 @@ h-margin {
background-color: #cc0000; /* Darker red on hover */
color: white; /* White text on hover */
}
.top-link {
display: block;
text-align: center;
margin-top: 10px;
font-style: italic;
text-decoration: underline;
}
.login-buttons {
position: relative;
display: flex;
margin-left: 10px;
gap: 10px;
padding: 0px;
}
.login-buttons .button {
display: block;
padding: 8px 8px;
border: none;
background: none;
border-radius: 4px;
text-align: center;
text-decoration: underline;
color: #333;
transition: background 0.2s;
}
.login-buttons .button:hover {
background: #f39200;
}

@ -5,13 +5,22 @@
{% block content %}
{% include 'tournaments/navigation_base.html' %}
<nav class="margin10">
<a href="{% url 'index' %}">Accueil</a>
<a href="{% url 'clubs' %}">Clubs</a>
{% if user.is_authenticated %}
<a href="{% url 'my-tournaments' %}">Mes tournois</a>
<a href="{% url 'profile' %}">Mon compte</a>
<a href="{% url 'logout' %}">Se déconnecter</a>
{% else %}
<a href="{% url 'login' %}">Se connecter</a>
{% endif %}
</nav>
{% load static %}
{% load tz %}
<div class="grid-x">
<div class="cell medium-6 large-6 topblock my-block">
<div class="cell medium-6 large-6 topblock my-block">
<div class="bubble">
<label class="title">Mes informations</label>
<form method="post">
@ -20,7 +29,8 @@
<button type="submit" class="rounded-button">Sauver les changements</button>
</form>
</div>
<div class="cell medium-6 large-6 topblock my-block">
</div>
<div class="cell medium-6 large-6 topblock my-block">
<div class="bubble">
<label class="title">Mot de passe</label>
<form method="post" action="{% url 'password_change' %}">

@ -1,5 +1,7 @@
<!DOCTYPE html>
<html>
<!-- <a href="{% url 'download' %}" class="top-link">Vous êtes juge-arbitre ? Téléchargez l'app pour organiser vos tournois !</a> -->
{% load static %}
<head>
@ -54,7 +56,8 @@
</div>
</a>
</div>
{% block right_header %}{% endblock %}
{% block right_header %}
{% endblock %}
</div>
</header>

@ -5,7 +5,6 @@
{% if user.is_authenticated %}
<a href="{% url 'my-tournaments' %}">Mes tournois</a>
<a href="{% url 'profile' %}">Mon compte</a>
<a href="{% url 'logout' %}">Se déconnecter</a>
{% else %}
<a href="{% url 'login' %}">Se connecter</a>
{% endif %}

@ -1,3 +1,11 @@
<nav class="margin10">
{% if user.is_authenticated %}
<a href="{% url 'profile' %}">Mon compte</a>
{% else %}
<a href="{% url 'login' %}">Se connecter</a>
{% endif %}
</nav>
<nav class="margin10">
<a href="{% url 'tournament-info' tournament.id %}" class="topmargin5">Informations</a>
@ -21,5 +29,4 @@
{% if tournament.display_rankings %}
<a href="{% url 'tournament-rankings' tournament.id %}" class="topmargin5">Classement</a>
{% endif %}
</nav>

@ -45,9 +45,6 @@
</p>
{% endif %}
<div>{{ tournament.build_tournament_details_str|linebreaksbr }}</div>
<div>{{ tournament.build_name_details_str|linebreaksbr }}</div>
{% if tournament.online_register_is_enabled %}
<p>

@ -1000,7 +1000,7 @@ def my_tournaments(request):
'user_name': user.username
})
from django.contrib.auth.forms import PasswordChangeForm
from .forms import CustomPasswordChangeForm
class ProfileUpdateView(UpdateView):
model = CustomUser
@ -1013,5 +1013,5 @@ class ProfileUpdateView(UpdateView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['password_change_form'] = PasswordChangeForm(user=self.request.user)
context['password_change_form'] = CustomPasswordChangeForm(user=self.request.user)
return context

Loading…
Cancel
Save