apps: retire tous les champs d'enregistrement sauf mot de passe
This commit is contained in:
parent
31aa01e608
commit
c2ccbb78a9
|
@ -366,6 +366,8 @@ class AppConfig(django.apps.AppConfig):
|
||||||
other_actions.append(RemoveFranceConnect())
|
other_actions.append(RemoveFranceConnect())
|
||||||
|
|
||||||
def a2_hook_front_modify_form(self, view, form):
|
def a2_hook_front_modify_form(self, view, form):
|
||||||
|
from django.forms.widgets import HiddenInput
|
||||||
|
|
||||||
if view.__class__.__name__ == 'EditProfile':
|
if view.__class__.__name__ == 'EditProfile':
|
||||||
if form.instance and form.instance.attributes.validated:
|
if form.instance and form.instance.attributes.validated:
|
||||||
for field in ('first_name', 'last_name', 'birthdate', 'title',
|
for field in ('first_name', 'last_name', 'birthdate', 'title',
|
||||||
|
@ -378,7 +380,13 @@ class AppConfig(django.apps.AppConfig):
|
||||||
field.widget.attrs['maxlength'] = 128
|
field.widget.attrs['maxlength'] = 128
|
||||||
elif view.__class__.__name__ == 'RegistrationCompletionView':
|
elif view.__class__.__name__ == 'RegistrationCompletionView':
|
||||||
form.initial['preferred_username'] = view.token.get('last_name', '')
|
form.initial['preferred_username'] = view.token.get('last_name', '')
|
||||||
|
form.fields['preferred_username'].widget = HiddenInput()
|
||||||
form.initial['preferred_givenname'] = view.token.get('first_name', '')
|
form.initial['preferred_givenname'] = view.token.get('first_name', '')
|
||||||
|
form.fields['preferred_givenname'].widget = HiddenInput()
|
||||||
|
|
||||||
|
for name in form.fields:
|
||||||
|
if 'password' not in name and name not in ('preferred_username', 'preferred_givenname'):
|
||||||
|
form.fields.pop(name)
|
||||||
|
|
||||||
def a2_hook_api_modify_queryset(self, view, queryset):
|
def a2_hook_api_modify_queryset(self, view, queryset):
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
|
|
Loading…
Reference in New Issue