Projet

Général

Profil

0001-franceconnect-add-scopes-setting-39286.patch

Benjamin Dauvergne, 27 janvier 2020 13:22

Télécharger (1,59 ko)

Voir les différences:

Subject: [PATCH] franceconnect: add scopes setting (#39286)

 hobo/franceconnect/forms.py | 1 +
 hobo/franceconnect/views.py | 5 +++++
 2 files changed, 6 insertions(+)
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.CharField(label=_('Scopes'), widget=forms.Textarea)
36 37

  
37 38

  
38 39
class EnableForm(forms.Form):
hobo/franceconnect/views.py
43 43

  
44 44
        initial['client_id'] = get_variable('A2_FC_CLIENT_ID').value
45 45
        initial['client_secret'] = get_variable('A2_FC_CLIENT_SECRET').value
46
        initial['scopes'] = get_variable('A2_FC_CLIENT_SCOPES').value or 'profile'
46 47

  
47 48
        return initial
48 49

  
......
79 80
        variable.value = 'true'
80 81
        variable.save()
81 82

  
83
        variable = get_variable('A2_FC_SCOPES')
84
        variable.json = form.cleaned_data['scopes'].split()
85
        variable.save()
86

  
82 87
        return super(HomeView, self).form_valid(form)
83 88

  
84 89
    def get_context_data(self, **kwargs):
85
-