{% extends "userdbs/base.html" %}
{% load i18n crispy_forms_tags %}

{% block title %}{{ block.super }} - {% spaceless %}
    {% if customer == user %}
        {% blocktranslate with dbuser=dbuser.name %}Set Database User Password for {{ dbuser }}{% endblocktranslate %}
    {% else %}
        {% blocktranslate with dbuser=dbuser.name full_name=customer.get_full_name trimmed %}
            Set Database User Password for {{ dbuser }} of Customer {{ full_name }}
        {% endblocktranslate %}
    {% endif %}
{% endspaceless %}{% endblock title %}

{% block page_title %}{% spaceless %}
    {% if customer == user %}
        {% blocktranslate with dbuser=dbuser.name trimmed %}
            Set Database User Password <small>for {{ dbuser }}</small>
        {% endblocktranslate %}
    {% else %}
        {% blocktranslate with dbuser=dbuser.name full_name=customer.get_full_name trimmed %}
            Set Database User Password <small>for {{ dbuser }} of Customer {{ full_name }}</small>
        {% endblocktranslate %}
    {% endif %}
{% endspaceless %}{% endblock page_title %}

{% block content %}
    <p>{% spaceless %}{% if customer == user %}
        {% translate "Please specify the new password for your database user." %}
    {% else %}
        {% translate "Please specify the new password of the database user." %}
    {% endif %}{% endspaceless %}</p>
    {% crispy form %}
{% endblock content %}

{% block extra_js %}
    <script type="text/javascript">
        document.addEventListener("DOMContentLoaded", function () {
            let passwordFields = document.querySelectorAll('input[type=password]');

            for (const passwordFieldsKey in passwordFields) {
                passwordFields[passwordFieldsKey].val('');
            }

            passwordFields[0].focus();
        });
    </script>
{% endblock extra_js %}