przewiń do treści

Symfony 2 od podstaw

Włodzimierz Gajda

{% extends "::base.html.twig" %}

{% block body %}
    {% if error %}
        <div>{{ error|trans({}, 'FOSUserBundle') }}</div>
    {% endif %}

    <form action="{{ path("fos_user_security_check") }}" method="post">
        <input type="hidden" name="_csrf_token" value="{{ csrf_token }}" />

        <label for="username">{{ 'security.login.username'|trans({}, 'FOSUserBundle') }}</label>
        <input type="text" id="username" name="_username" value="{{ last_username }}" />

        <label for="password">{{ 'security.login.password'|trans({}, 'FOSUserBundle') }}</label>
        <input type="password" id="password" name="_password" />

        <input type="checkbox" id="remember_me" name="_remember_me" value="on" />
        <label for="remember_me">{{ 'security.login.remember_me'|trans({}, 'FOSUserBundle') }}</label>

        <input type="submit" id="_submit" name="_submit" value="{{ 'security.login.submit'|trans({}, 'FOSUserBundle') }}" />
    </form>

    {% for key, message in app.session.getFlashes() %}
    <div class="{{ key }}">
        {{ message|trans({}, 'FOSUserBundle') }}
    </div>
    {% endfor %}

{% endblock body %}

Listing 38.5. Dostosowany formularz do logowania

Rozdział 38. Aplikacja dostępna wyłącznie dla zdefiniowanych użytkowników

listing-38-05.txt

Reklama

Szkolenia z Symfony 2.1
©2012 Włodzimierz Gajda
ver. 1.0.1