{% extends 'TopxiaWebBundle::layout.html.twig' %}

{% block title %}登录 - {{ parent() }}{% endblock %}
{% set script_controller = 'auth/login' %}
{% block content %}
<link rel="stylesheet" media="screen" href="{{ asset('bundles/topxiaweb/css/auth.css') }}" />

<div class="row row-6">
  <div class="col-md-6 col-md-offset-3">

    <div class="panel panel-default panel-page">
      <div class="panel-heading"><h2>登录</h2></div>

      <form id="login-form" class="form-vertical" method="post" action="{{ path('login_check') }}">

        {% if error %}
          <div class="alert alert-danger">{{ error.message|trans }}</div>
        {% endif %}
        {{ web_macro.flash_messages() }}
        <div class="form-group">
          <label class="control-label" for="login_username">帐号</label>
          <div class="controls">
            <input class="form-control" id="login_username" type="text" name="_username" value="{{ last_username }}" required placeholder='邮箱/手机/昵称' />
            <div class="help-block"></div>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label" for="login_password">密码</label>
          <div class="controls">
            <input class="form-control" id="login_password" type="password" name="_password" required placeholder='密码'/>
          </div>
        </div>

        <div class="form-group">
          <div class="controls">
            <span class="checkbox mtm pull-right">
              <label> <input type="checkbox" name="_remember_me" checked="checked"> 记住密码 </label>
            </span>
            <button type="submit" class="btn btn-fat btn-primary btn-large">登录</button>
          </div>
        </div>

        <input type="hidden" name="_target_path" value="{{ _target_path }}">
        <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
      </form>

      <div class="ptl">
          <a href="{{ path('password_reset') }}">找回密码</a>
          <span class="text-muted mhs">|</span>
          <span class="text-muted">还没有注册帐号？</span>
          <a href="{{ path('register', {goto:_target_path}) }}">立即注册</a>
      </div>

      {% if setting('login_bind.enabled') %}
        <div class="social-logins">
          {{ render(controller('TopxiaWebBundle:Login:oauth2LoginsBlock', {targetPath:_target_path})) }}
        </div>
      {% endif %}
    </div>

  </div>
</div>
{% endblock %}