getgrav / grav-plugin-login

Grav Login Plugin
http://getgrav.org
MIT License
44 stars 54 forks source link

Missing User and password input fields in a page with login form #200

Closed sergixnet closed 5 years ago

sergixnet commented 5 years ago

Hi

I have a problem creating a page with a login form.

I'm creating a custom theme.

Plugins used:

GRAV v1.5.7

The problem is that the user and password fields are missing when I include the login form, this is the template code:

{% extends 'partials/base.html.twig' %}

{% block content %}

    <div id="maintenance-login" style="text-align: center;">
        {% include 'partials/login-form.html.twig' with {content: 'PLUGIN_MAINTENANCE.AUTHORIZED_ACCESS'|t|markdown,
        show_login_form: true }%}
    </div>
{% endblock %}

An this is the result:

captura de pantalla de 2019-02-06 11-30-32

The same problem is replicated when using Maintenance mode activated and enabled the login form:

captura de pantalla de 2019-02-06 11-34-22

What can I do to solve this?

Thanks

rhukster commented 5 years ago

You also need the form plugin.

sergixnet commented 5 years ago

Hi @rhukster

Thanks for the answer.

I have the form plugin installed too. These are the plugins I have installed now:

captura de pantalla de 2019-02-13 09-10-49

The Grav version now is v1.5.8

But the user and input fields are missing when activating the maintenance mode.

Thanks

rhukster commented 5 years ago

Are you running version 1.3.2 of the maintenance plugin?

Your Twig 'should' look like this by default:

{% extends 'partials/base.html.twig' %}

{% block content %}

    {{ page.content|default('PLUGIN_MAINTENANCE.OFFLINE_MARKDOWN'|t|markdown|raw) }}

    {% if maintenance.allow_login and not grav.user.authenticated %}
        <div id="maintenance-login" style="text-align: center;">
            {% include 'partials/login-form.html.twig' with {content: 'PLUGIN_MAINTENANCE.AUTHORIZED_ACCESS'|t|markdown, show_login_form: true }%}
        </div>
    {% endif %}
{% endblock %}
sergixnet commented 5 years ago

I have maintenance 1.3.2 and with the default template the result is the same. User and password fields are missing:

captura de pantalla de 2019-02-14 10-58-12

Al I want is that any admin could see the frontend of the site at the same time with the maintenance mode activated.

mahagr commented 5 years ago

Try adding user/pages/login/login.md with this content:

---
title: Login
login_redirect_here: false
classes: login-backdrop

forms:
  login:
    client_side_validation: true

    fields:
      username:
        type: text
        id: username
        label: Email Address
        autofocus: true
        datasets:
          value-missing: 'email field required'
        validate:
          required: true

      password:
        type: password
        id: password
        label: Password
        datasets:
          value-missing: 'password field required'
        validate:
            required: true
---

# Login
sergixnet commented 5 years ago

Thank you @mahagr with that markdown page, I get a working login page.

One point: if you create another page to do that with a different title and file name, you must put slug: login in the frontmatter, else doesn't work.

Thanks