diff --git a/CHANGELOG b/CHANGELOG index 3d787bf1..7b91303f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,8 @@ * Version 0.3 - ??? +- Comptes extés: lien pour changer son mot de passe sur la page d'accueil +- Les utilisateurices non-COF peuvent éditer leur profil - Un peu de pub pour KDEns sur la page d'accueil - Fix erreur 500 sur /bda/revente//manage - Si on essaie d'accéder au compte que qqn d'autre on a une 404 (et plus une 403) diff --git a/gestioncof/forms.py b/gestioncof/forms.py index 755d44af..6147aa78 100644 --- a/gestioncof/forms.py +++ b/gestioncof/forms.py @@ -214,6 +214,12 @@ class UserForm(forms.ModelForm): fields = ["first_name", "last_name", "email"] +class PhoneForm(forms.ModelForm): + class Meta: + model = CofProfile + fields = ["phone"] + + class ProfileForm(forms.ModelForm): class Meta: model = CofProfile diff --git a/gestioncof/templates/gestioncof/home.html b/gestioncof/templates/gestioncof/home.html index 9569af43..8b014ee8 100644 --- a/gestioncof/templates/gestioncof/home.html +++ b/gestioncof/templates/gestioncof/home.html @@ -56,18 +56,19 @@ - {% if user.profile.is_cof %}

Divers

- +
- {% endif %} {% if user.profile.is_buro %}
diff --git a/gestioncof/tests/test_views.py b/gestioncof/tests/test_views.py index e945a87a..31cb8d8a 100644 --- a/gestioncof/tests/test_views.py +++ b/gestioncof/tests/test_views.py @@ -362,7 +362,7 @@ class ProfileViewTests(ViewTestCaseMixin, TestCase): http_methods = ["GET", "POST"] auth_user = "member" - auth_forbidden = [None, "user"] + auth_forbidden = [None] def test_get(self): r = self.client.get(self.url) diff --git a/gestioncof/views.py b/gestioncof/views.py index f4a8be14..6c7bf337 100644 --- a/gestioncof/views.py +++ b/gestioncof/views.py @@ -33,6 +33,7 @@ from gestioncof.forms import ( EventStatusFilterForm, ExteAuthenticationForm, GestioncofConfigForm, + PhoneForm, ProfileForm, RegistrationPassUserForm, RegistrationProfileForm, @@ -355,12 +356,13 @@ def survey_status(request, survey_id): ) -@cof_required +@login_required def profile(request): user = request.user data = request.POST if request.method == "POST" else None user_form = UserForm(data=data, instance=user, prefix="u") - profile_form = ProfileForm(data=data, instance=user.profile, prefix="p") + profile_form_klass = ProfileForm if user.profile.is_cof else PhoneForm + profile_form = profile_form_klass(data=data, instance=user.profile, prefix="p") if request.method == "POST": if user_form.is_valid() and profile_form.is_valid(): user_form.save()