{# SPDX-FileCopyrightText: 2015-2020 CERN. SPDX-License-Identifier: MIT #} {% macro render_checkbox(field, label='') %}
{{ field(class_="form-control") }} {{ field.label }}
{% endmacro %} {% macro render_field_errors(errors) %} {% if errors is not mapping %} {%- else %} {%- endif %} {% endmacro %} {% macro render_field(field, icon="", placeholder='', autofocus=False) %} {%- if field.errors %} {{ render_field_errors(field.errors) }} {%- endif %}
{%- if field.widget.input_type == 'hidden' %} {{ field() }} {%- elif field.widget.input_type == 'checkbox' %} {{ render_checkbox(field, label=_(field.label.text | string)) }} {%- else %} {%- set extras = dict(autofocus="") if autofocus else dict() %} {%- set _placeholder = placeholder if placeholder else _(field.label.text | string) %} {{field(class_="form-control", placeholder=_placeholder, **extras)}} {%- if icon %} {%- endif%} {%- endif%}
{% endmacro %} {% macro oauth_button(name, next=None) %} {%- set remote_app = config.OAUTHCLIENT_REMOTE_APPS[name] %}
{%- if remote_app.get('icon_image') %} {%- else %} {%- endif %} {{ _('Sign in with %(title)s', title=remote_app['title']) }}
{% endmacro %}