diff --git a/apps/gooyal_oauth2/forms.py b/apps/gooyal_oauth2/forms.py index 678583c..7f76470 100644 --- a/apps/gooyal_oauth2/forms.py +++ b/apps/gooyal_oauth2/forms.py @@ -55,21 +55,25 @@ class ApplicationForm(forms.ModelForm): class ApplicationCreateForm(forms.ModelForm): class Meta: model = Application - fields = ['name', - 'client_id', - 'client_secret', - # 'available_scopes_list', - # 'authorization_grant_type', - 'redirect_uris', - 'post_logout_redirect_uris'] - - readonly_fields = ['client_id', 'client_secret'] + fields = [ + 'name', + # 'client_id', + # 'client_secret', + # 'available_scopes_list', + # 'authorization_grant_type', + 'redirect_uris', + # 'post_logout_redirect_uris' + ] class ApplicationUpdateForm(forms.ModelForm): + name = forms.CharField(disabled=True) + client_id = forms.CharField(disabled=True) + client_secret = forms.CharField(disabled=True) class Meta: model = Application fields = [ + 'name', 'client_id', 'client_secret', # 'authorization_grant_type', diff --git a/apps/gooyal_oauth2/views/pages.py b/apps/gooyal_oauth2/views/pages.py index d30ca88..cfeaceb 100644 --- a/apps/gooyal_oauth2/views/pages.py +++ b/apps/gooyal_oauth2/views/pages.py @@ -22,6 +22,9 @@ class ApplicationCreateView(CreateView): def form_valid(self, form): form.instance.user = self.request.user form.instance.client_type = Application.CLIENT_PUBLIC + form.instance.algorithm = Application.RS256_ALGORITHM + form.instance.hash_client_secret = False + form.instance.authorization_grant_type = Application.GRANT_AUTHORIZATION_CODE return super().form_valid(form) diff --git a/templates/gooyal_oauth2/application_create.html b/templates/gooyal_oauth2/application_create.html index 1c09d51..0603b09 100644 --- a/templates/gooyal_oauth2/application_create.html +++ b/templates/gooyal_oauth2/application_create.html @@ -3,8 +3,8 @@ {% load crispy_forms_tags %} {% load jalali_tags %} -{% block title %}Application: create{% endblock %} -{% block page_title %}Application: create{% endblock %} +{% block title %}Application Register{% endblock %} +{% block page_title %}Application Register{% endblock %} {% block content %}
@@ -15,6 +15,7 @@
diff --git a/templates/gooyal_oauth2/application_detail.html b/templates/gooyal_oauth2/application_detail.html index 8f97c1f..53597c6 100644 --- a/templates/gooyal_oauth2/application_detail.html +++ b/templates/gooyal_oauth2/application_detail.html @@ -3,8 +3,19 @@ {% load crispy_forms_tags %} {% load jalali_tags %} -{% block title %}Application: detail{% endblock %} -{% block page_title %}Application: detail{% endblock %} +{% block title %}Application Detail: {{ object }}{% endblock %} +{% block page_title %}Application Detail: {{ object }}{% endblock %} + +{% block page_action %} + +{% endblock %} + {% block content %}

application: {{ object.name }}!

diff --git a/templates/gooyal_oauth2/application_list.html b/templates/gooyal_oauth2/application_list.html index ba050d2..f4e15a5 100644 --- a/templates/gooyal_oauth2/application_list.html +++ b/templates/gooyal_oauth2/application_list.html @@ -5,8 +5,8 @@ {% load tags %} -{% block title %}Application: list{% endblock %} -{% block page_title %}Application: list{% endblock %} +{% block title %}Application List{% endblock %} +{% block page_title %}Application List{% endblock %} {% block page_action %} {% include "include/filter_action.html" %}
diff --git a/templates/gooyal_oauth2/application_update.html b/templates/gooyal_oauth2/application_update.html index fd48f71..838e3b6 100644 --- a/templates/gooyal_oauth2/application_update.html +++ b/templates/gooyal_oauth2/application_update.html @@ -3,8 +3,8 @@ {% load crispy_forms_tags %} {% load jalali_tags %} -{% block title %}Application: update{% endblock %} -{% block page_title %}Application: update{% endblock %} +{% block title %}Application Update: {{ object }}{% endblock %} +{% block page_title %}Application Update: {{ object }}{% endblock %} {% block content %} @@ -15,6 +15,7 @@