diff --git a/tournaments/forms.py b/tournaments/forms.py index db57a06..21d95f7 100644 --- a/tournaments/forms.py +++ b/tournaments/forms.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) diff --git a/tournaments/static/tournaments/css/style.css b/tournaments/static/tournaments/css/style.css index 3998cf8..38ad109 100644 --- a/tournaments/static/tournaments/css/style.css +++ b/tournaments/static/tournaments/css/style.css @@ -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; +} diff --git a/tournaments/templates/profile.html b/tournaments/templates/profile.html index f2ce22c..b3b68ad 100644 --- a/tournaments/templates/profile.html +++ b/tournaments/templates/profile.html @@ -5,24 +5,34 @@ {% block content %} -{% include 'tournaments/navigation_base.html' %} + {% load static %} {% load tz %} -
diff --git a/tournaments/views.py b/tournaments/views.py index 77ce041..8122af5 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -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