{% set layout = layout ?? form.layout ?? 'default' %} {% set field_layout = layout %} {% set client_side_validation = form.client_side_validation is not null ? form.client_side_validation : config.plugins.form.client_side_validation|default(true) %} {% set inline_errors = form.inline_errors is not null ? form.inline_errors : config.plugins.form.inline_errors(false) %}
{% if page.template == 'login' or show_login_form %} {% set user = grav.user %} {% if user.authenticated and user.authorized %}

{{ 'PLUGIN_LOGIN.WELCOME'|t }} {{ user.fullname ?: user.username }}


{{ 'PLUGIN_LOGIN.BTN_LOGOUT'|t }} {% elseif user.authenticated and user.twofa_enabled %} {% include 'partials/login-twofa.html.twig' %} {% else %} {{ content|raw }} {# NEW WAY OF INCLUDING 3RD PARTY LOGIN OPTIONS #} {% for template in grav.login.getProviderLoginTemplates %} {% include template %} {% endfor %}
{# OLD WAY OF INCLUDING 3RD PARTY LOGIN OPTIONS #} {% if grav.twig.plugins_hooked_loginPage %} {% for label in grav.twig.plugins_hooked_loginPage %} {% include label %} {% endfor %} {% endif %} {% for field in form.fields %} {% set field = prepare_form_field(field, field_name) %} {% if field %} {% set value = field.name == 'username' ? username : '' %} {# {% set value = form.value(field.name) %} #} {% set field_templates = include_form_field(field.type, field_layout) %} {% block field %} {% include field_templates ignore missing %} {% endblock %} {% endif %} {% endfor %}
{% if config.plugins.login.rememberme.enabled and form.login.rememberme ?? true %}
{% endif %} {% set forgot_button = form.login.forgot_button ?? true %} {% set forgot_route = grav.login.getRoute('forgot') %} {% if forgot_button and forgot_route %} {{ 'PLUGIN_LOGIN.BTN_FORGOT'|t }} {% endif %}
{{ nonce_field('login-form', 'login-form-nonce')|raw }}
{% endif %} {% endif %}