diff --git a/sso/forms.py b/sso/forms.py index 7f8b863..fc00041 100644 --- a/sso/forms.py +++ b/sso/forms.py @@ -23,6 +23,18 @@ class MultiCheckboxField(SelectMultipleField): option_widget = widgets.CheckboxInput() +class RadioField(SelectField): + """ + A multiple-select, except displays a list of checkboxes. + + Iterating the field will produce subfields, allowing custom rendering of + the enclosed checkbox fields. + """ + + widget = widgets.ListWidget(prefix_label=False) + option_widget = widgets.RadioInput() + + class LoginForm(FlaskForm): username = StringField("username", validators=[DataRequired()]) password = PasswordField("password", validators=[DataRequired()]) @@ -48,7 +60,7 @@ class ClientForm(FlaskForm): default=["code"], ) - token_endpoint_auth_method = SelectField( + token_endpoint_auth_method = RadioField( "Token endpoint authentication method", choices=[("client_secret_basic", "Basic"), ("client_secret_post", "POST"), ("client_secret_get", "Query args (DEPRECATED)")], validators=[DataRequired()], diff --git a/templates/_helpers.html b/templates/_helpers.html index 7691789..8cafe7a 100644 --- a/templates/_helpers.html +++ b/templates/_helpers.html @@ -11,7 +11,7 @@ None {% macro format_currency_raw(amount, precision=0) -%} {{ ("%%.%sf" | format(precision) | format(amount/100)) }}SOG {%- endmacro %} -{% macro render_field(field, prefix=None, suffix=None, layout=True, label=True, split=3) %} +{% macro render_field(field, prefix=None, suffix=None, layout=True, label=True, split=4) %} {% if field.type == 'HiddenField' or field.type == 'CSRFTokenField' %} {{ field(**kwargs) }} {% else %} diff --git a/templates/client_edit.html b/templates/client_edit.html index 0bb2e93..55a38d6 100644 --- a/templates/client_edit.html +++ b/templates/client_edit.html @@ -4,15 +4,15 @@ {% macro static_field(id, label, value) %}
- -
+ +
{% endmacro %} {% block content %}
-
+
@@ -26,15 +26,15 @@ {{ render_field(form.response_types) }} {{ render_field(form.scope) }}
-
+
{% if client is defined %} {{ static_field('client_id', 'Client ID', client.client_id) }}
- -
+ +