{# -*- coding: utf-8 -*-

  This file is part of Invenio.
  Copyright (C) 2015-2020 CERN.

  Invenio is free software; you can redistribute it and/or modify it
  under the terms of the MIT License; see LICENSE file for more details.
#}
{%- extends config.ACCOUNTS_SETTINGS_TEMPLATE %}

{% from "invenio_accounts/_macros.html" import render_field, form_errors %}

{% set panel_title = _("Change password") %}
{% set panel_icon = current_theme_icons.key %}

{% block settings_form %}
{%- with form = change_password_form %}
<form class="ui form" action="{{ url_for_security('change_password') }}" method="POST" name="change_password_form">
  {{ form.hidden_tag() }}
  <div class="field">
    <label for="password">{{_('Current password')}}</label>
    {{ render_field(form.password, autofocus=True, errormsg='password' in form.errors) }}
  </div>
  <div class="field">
    <label for="new_password">{{_('New password')}}</label>
    {{ render_field(form.new_password, errormsg='new_password' in form.errors) }}
  </div>
  <div class="field">
    <label for="new_password_confirm">{{_('Confirm new password')}}</label>
    {{ render_field(form.new_password_confirm, errormsg='new_password' in form.errors) }}
  </div>
  <button type="submit" class="ui submit primary button">
    <i class="check icon"></i>
    {{_('Change Password')}}
  </button>
</form>
{%- endwith %}
{% endblock settings_form %}
