{% extends 'settings/layout.html.twig' %}
{% block title %}{{'设置支付密码'|trans}} - {{'安全设置'|trans}} - {{ parent() }}{% endblock %}
{% do script(['libs/jquery-validation.js', 'app/js/settings/reset-pay-password/index.js']) %}
{% set side_nav = 'security' %}
{% do script(['libs/jquery-validation.js', 'app/js/settings/reset-pay-password/index.js']) %}

{% block main %}
 {% embed "bootstrap/panel.html.twig" with {class:'panel-col'} %}
    {% block heading %}
      {{'安全设置'|trans}}
    {% endblock %}
    {% block body %}

      <ul class="breadcrumb">
        <li><a href="{{ path('settings_security') }}">{{'安全设置'|trans}}</a></li>
        <li class="active">{{'设置支付密码'|trans}}</li>
      </ul>


      {% if not app.user.password %}
        <div class="alert alert-warning">
          <p>{{'当前帐号从第三方帐号直接登录时创建，尚未设置登录密码。'|trans}}</p>
          <p>{{'为了帐号的安全，请通过邮箱找回密码的方式，重设登录密码！'|trans}}</p>
          <p><a href="{{ path('password_reset') }}" class="btn btn-primary">{{'现在就去重设登录密码！'|trans}}</a></p>
        </div>
      {% endif %}

      <form id="settings-pay-password-form" class="form-horizontal" method="post" {% if not app.user.password %} style="display:none;"{% endif %}>

        {{ web_macro.flash_messages() }}

        {# <div class="form-group">
          <div class="col-md-3 control-label">{{ form_label(form.currentUserLoginPassword, '用户登录密码') }}</div>
          <div class="controls col-md-8 controls">
            {{ form_widget(form.currentUserLoginPassword, {attr:{class:'form-control'}}) }}
          </div>
        </div> #}

        <div class="form-group">
          <div class="col-md-3 control-label">
              {{ form_label(form.oldPayPassword, '旧的支付密码'|trans) }}
          </div>
          <div class="controls col-md-8 controls">
            {{ form_widget(form.oldPayPassword, {attr:{class:'form-control'}}) }}
            <a href="{{ path('settings_find_pay_password') }}" class="help-block color-gray" >{{'忘记支付密码？'|trans}}</a>
          </div>
        </div>

        <div class="form-group">
          <div class="col-md-3 control-label">{{ form_label(form.newPayPassword, '新支付密码'|trans) }}</div>
          <div class="controls col-md-8 controls">
            {{ form_widget(form.newPayPassword, {attr:{class:'form-control'}}) }}
          </div>
        </div>

        <div class="form-group">
          <div class="col-md-3 control-label">{{ form_label(form.confirmPayPassword, '确认支付密码'|trans) }}</div>
          <div class="controls col-md-8 controls">
            {{ form_widget(form.confirmPayPassword, {attr:{class:'form-control'}}) }}
          </div>
        </div>

        <div class="form-group">
          <div class="col-md-3 control-label"></div>
          <div class="controls col-md-8 controls">
            {{ form_rest(form) }}
            <button id="password-save-btn" data-loading-text="{{'正在保存'|trans}}" type="button" class="btn btn-primary">{{'提交'|trans}}</button>
          </div>
        </div>

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

      </form>


    {% endblock %}
  {% endembed %}
{% endblock %}