<h2>{{ _t('LOGIN_CHANGE_PASSWORD') }}</h2>

<p class="welcome-text">
  <strong>{{ _t('LOGIN_WELCOME') }} {{ user.name }}</strong><br/>
  {{ _t('LOGIN_WRITE_PASSWORD') }}
</p>

{% if errorType == 'differentPasswords' %}
  <div class="alert alert-danger">{{ _t('LOGIN_PASSWORD_SHOULD_BE_IDENTICAL') }}.</div>
{% elseif errorType %}
  <div class="alert alert-danger">{{ message is not empty ? message : errorType }}</div>
{% endif %}

<form action="{{ url({handler:''}) }}" method="post">
  {% if inIframe %}
    {# security message to explain that resetting pwd in iframe #}
    <div class="alert alert-warning">
      {% set urlWithoutIframe = url({
        handler: "show",
        params: (request.get.a is not empty and request.get.email is not empty and request.get.u is not empty) ? {
          a: request.get.a,
          email: request.get.email,
          u: request.get.u
        } : {}
      })|replace({"/show":""}) %}
      {{ _t('USERSETTINGS_CHANGE_PWD_IN_IFRAME')|replace({
        "{baseUrl}": urlWithoutIframe,
        "{link}": "<a target=\"_blank\" href=\"#{urlWithoutIframe}\">#{urlWithoutIframe}</a>"
      })|raw|nl2br|raw }}
    </div>
  {% endif %}
  <div class="form-group">
    <label for="pw0">{{ _t('LOGIN_NEW_PASSWORD') }}</label>
    <input type="password" class="form-control" name="pw0" id="pw0" value="" maxlength="40" required>
  </div>
  <div class="form-group">
    <label for="pw1">{{ _t('LOGIN_CONFIRM_PASSWORD') }}</label>
    <input type="password" class="form-control" name="pw1" id="pw1" value="" maxlength="40" required>
  </div>
  <input type="hidden" name="subStep" value="2" />
  <input type="hidden" name="userID" value="{{ user.name }}" />
  <input type="hidden" name="key" value="{{ key }}" />
  <button type="submit" class="btn btn-primary">{{ _t('LOGIN_SEND') }}</button>
</form>