0001-franceconnect-add-scopes-setting-39286.patch
hobo/franceconnect/forms.py | ||
---|---|---|
33 | 33 |
client_secret = forms.CharField( |
34 | 34 |
label=_('Client Secret'), |
35 | 35 |
widget=forms.TextInput(attrs={'size': 64})) |
36 |
scopes = forms.MultipleChoiceField( |
|
37 |
label=_('Scopes'), |
|
38 |
choices=[ |
|
39 |
('given_name', _('given name')), |
|
40 |
('gender', _('gender')), |
|
41 |
('birthdate', _('birthdate')), |
|
42 |
('birthcountry', _('birthcountry')), |
|
43 |
('birthplace', _('birthplace')), |
|
44 |
('family_name', _('family name')), |
|
45 |
('email', _('email')), |
|
46 |
('preferred_username', _('usual family name')), |
|
47 |
('address', _('address')), |
|
48 |
('phone', _('phone')), |
|
49 |
('identite_pivot', _('identite_pivot')), |
|
50 |
('profile', _('profile')), |
|
51 |
('birth', _('birth profile')), |
|
52 |
], |
|
53 |
widget=forms.CheckboxSelectMultiple) |
|
36 | 54 | |
37 | 55 | |
38 | 56 |
class EnableForm(forms.Form): |
hobo/franceconnect/views.py | ||
---|---|---|
60 | 60 | |
61 | 61 |
initial['client_id'] = get_variable('A2_FC_CLIENT_ID').value |
62 | 62 |
initial['client_secret'] = get_variable('A2_FC_CLIENT_SECRET').value |
63 |
initial['scopes'] = get_variable('A2_FC_SCOPES').json or ['profile'] |
|
63 | 64 | |
64 | 65 |
return initial |
65 | 66 | |
... | ... | |
102 | 103 |
}, |
103 | 104 |
'email': 'email', |
104 | 105 |
}) |
106 | ||
107 |
variable = get_variable('A2_FC_SCOPES') |
|
108 |
variable.json = form.cleaned_data['scopes'] |
|
105 | 109 |
variable.save() |
106 | 110 | |
107 | 111 |
return super(HomeView, self).form_valid(form) |
108 |
- |