{% extends '_base_only_content.html' %}
{% load static %}
{% load i18n %}
{% load bootstrap3 %}
{% block custom_head_css_js %}
{% endblock %}

{% block html_title %}{% trans 'Verify password' %}{% endblock %}
{% block title %} {% trans 'Verify password' %}{% endblock %}

{% block content %}
    <form class="" role="form" method="post" action="" class="form-horizontal">
        {% if 'password' in form.errors %}
            <p class="red-fonts">{{ form.password.errors.as_text }}</p>
        {% endif %}
        {% csrf_token %}
        <div class="form-input form-group">
            <input type="password" id="password" autocomplete="off" class="form-control" name="{{ form.password.html_name }}" placeholder="{% trans 'Password' %}" required="">
        </div>
        <button type="submit" class="btn btn-primary">{% trans 'Confirm' %}</button>
    </form>
    <script type="text/javascript" src="/static/js/crypto.bundle.js"></script>
    <script type="text/javascript" src="/static/js/session-encrypt.js"></script>
    <script>
        $("form").submit(function(){
            // Let's find the input to check
            var passwordRef = $('#password')
            var value = passwordRef.val()
            if (value) {
                // Value is falsey (i.e. null), lets set a new one
                value = encryptPassword(value)
                passwordRef.val(value)
            }
        });
    </script>
{% endblock %}
