{% extends 'bootstrap-modal-layout.html.twig' %}

{% set modal_class = 'cd-modal-dialog' %}

{% do script(['libs/jquery-validation.js', 'app/js/settings/reset-pay-password/index.js']) %}

{% block title %}
  {{'user.settings.security.pay_password_set'|trans}}
{% endblock %}

{% block body %}
  {% if not app.user.password %}
    <div class="alert cd-alert cd-alert-warning">
      {{ 'user.settings.security.no_password_tips'|trans({'%passwordResetUrl%': path('password_reset')})|raw }}
    </div>
  {% else %}
    <form id="settings-pay-password-form" method="post" action="{{ path('settings_reset_pay_password') }}">
      <div class="form-group cd-form-group">
        <label for="form_oldPayPassword">{{ 'user.settings.security.pay_password_set.old_pay_password'|trans }}</label>
        <input id="form_oldPayPassword" type="password" class="form-control" name="oldPayPassword" placeholder="{{'user.settings.security.pay_password_set.old_pay_password_placeholder'|trans}}">
        <div class="help-block">
          <a href="{{ path('settings_find_pay_password') }}" class="cd-link-minor">{{'user.settings.security.pay_password_set.password_forget'|trans}}</a>
        </div>
      </div>
      <div class="form-group cd-form-group">
        <label for="form_newPayPassword">{{ 'user.settings.security.pay_password_set.new_pay_password'|trans }}</label>
        <input id="form_newPayPassword" type="password" class="form-control" name="newPayPassword" placeholder="{{'user.settings.security.pay_password_set.new_pay_password_placeholder'|trans}}">
      </div>
      <div class="form-group cd-form-group cd-mb24">
        <label for="form_confirmPayPassword">{{ 'user.settings.security.pay_password_set.confirm_pay_password'|trans }}</label>
        <input id="form_confirmPayPassword" type="password" class="form-control" name="confirmPayPassword" placeholder="{{'user.settings.security.pay_password_set.input_pay_password_again'|trans}}">
      </div>
      <input type="hidden" name="_csrf_token" value="{{ csrf_token('site') }}">
    </form>
  {% endif %}

{% endblock %}

{% block footer %}
  <button type="button" class="btn cd-btn cd-btn-flat-default cd-btn-lg" data-dismiss="modal">
    {{'form.btn.cancel'|trans}}
  </button>
  <button id="password-save-btn" type="button" class="btn cd-btn cd-btn-primary cd-btn-lg" data-toggle="form-submit"  data-target="#settings-pay-password-form" data-loading-text="{{'form.btn.save.submiting'|trans}}">{{'form.btn.submit'|trans}}</button>
{% endblock %}