getgrav / grav-plugin-login

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

Registration form throws RuntimeException #181

Closed amaury-hanser closed 5 years ago

amaury-hanser commented 5 years ago

Hello,

I'm using the Login plugin to create a private area.

I've created a custom login page with two forms (if that helps) :

When I try to use the registration form, I run into a RuntimeException :

Username should be between 3 and 16 characters, including lowercase letters, numbers, underscores, and hyphens. Uppercase letters, spaces, and special characters are not allowed

Do you have any idea where I could have been doing something wrong ?

I'm using Grav v1.5.5 With those plugins:

I already tryed to re-install the plugin with no success. If you need any more information, please just ask.

Thank you in advance !

Here is my login.md:

---
title: Espace membre
cache_enable: false
login_redirect_here: false

forms:
    login:
        action:
        method: post
        fields:
            -
                name: username
                type: text
                id: username
                placeholder: "Nom d'utilisateur"
                label: "Nom d'utilisateur"
                autofocus: true
            -
                name: password
                type: password
                id: password
                placeholder: "Mot de passe"
                label: "Mot de passe"
    register:
        action:
        fields:
            -
                name: Nom
                type: text
                validate:
                    required: true
            -
                name: Prénom
                type: text
                validate:
                    required: true
            -            
                name: Nom d'utilisateur
                type: text
                validate:
                    required: true
                    message: PLUGIN_LOGIN.USERNAME_NOT_VALID
                    config-pattern@: system.username_regex
            -
                name: email
                type: email
                validate:
                    required: true
                    message: PLUGIN_LOGIN.EMAIL_VALIDATION_MESSAGE
            -            
                name: password1
                type: password
                label: Choisissez un mot de passe
                validate:
                    required: true
                    message: PLUGIN_LOGIN.PASSWORD_VALIDATION_MESSAGE
                    config-pattern@: system.pwd_regex
            -
                name: password2
                type: password
                label: Répétez votre mot de passe
                validate:
                    required: true
                    message: PLUGIN_LOGIN.PASSWORD_VALIDATION_MESSAGE
                    config-pattern@: system.pwd_regex

        buttons:
            -
                type: submit
                value: Envoyer ma demande
                classes: bouton_1
        process:
            register_user: true
            message: "Thanks for registering..."
            reset: true
---

And here is my login.html.twig:

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

{% block content %}

<section class="row">
    <div class="flex-wrapper width-limited">
        <div class="flex-item w-100">
            <div class="inner">
                <h1 class="title title--rouge">
                    <span>Arc-En-Ciel Brignolais</span>
                    <span>Espace membre</span>
                </h1>
                {% include 'partials/messages.html.twig' %}
            </div>
        </div>
    </div>  
    <div class="flex-wrapper width-limited" id="contact-form">
        <div class="flex-item w-100 w-small-50">
            <div class="inner">
                <h2 class="title title--vert">
                    <span>Déjà membre</span>
                    <span>Se connecter</span>
                </h2>
                {% include "partials/login-form.html.twig" with { form: forms('login') } %}
            </div>
        </div>
        <div class="flex-item w-100 w-small-50">
            <div class="inner">
                <h2 class="title title--bleu">
                    <span>Pas encore de compte ?</span>
                    <span>Demander un accès</span>
                </h2>
                {% include "forms/form.html.twig"  with { form: forms('register') } %}
            </div>
        </div>
    </div>
</section>
{% endblock %}
amaury-hanser commented 5 years ago

Should be closed. I'm too damn french and didn't realise that I've used accentuated characters in the name of the fields.