From a96ce168fe81b4693dce127aa73704188c605d14 Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Mon, 27 Jan 2020 13:22:04 +0100 Subject: [PATCH] franceconnect: add scopes setting (#39286) --- hobo/franceconnect/forms.py | 1 + hobo/franceconnect/views.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/hobo/franceconnect/forms.py b/hobo/franceconnect/forms.py index 6ed5d98..c37445d 100644 --- a/hobo/franceconnect/forms.py +++ b/hobo/franceconnect/forms.py @@ -33,6 +33,7 @@ class SettingsForm(forms.Form): client_secret = forms.CharField( label=_('Client Secret'), widget=forms.TextInput(attrs={'size': 64})) + scopes = forms.CharField(label=_('Scopes'), widget=forms.Textarea) class EnableForm(forms.Form): diff --git a/hobo/franceconnect/views.py b/hobo/franceconnect/views.py index 1a3b904..e7c0f83 100644 --- a/hobo/franceconnect/views.py +++ b/hobo/franceconnect/views.py @@ -43,6 +43,7 @@ class HomeView(FormView): initial['client_id'] = get_variable('A2_FC_CLIENT_ID').value initial['client_secret'] = get_variable('A2_FC_CLIENT_SECRET').value + initial['scopes'] = get_variable('A2_FC_CLIENT_SCOPES').value or 'profile' return initial @@ -79,6 +80,10 @@ class HomeView(FormView): variable.value = 'true' variable.save() + variable = get_variable('A2_FC_SCOPES') + variable.json = form.cleaned_data['scopes'].split() + variable.save() + return super(HomeView, self).form_valid(form) def get_context_data(self, **kwargs): -- 2.24.0