{% extends "base.html" %}
{% load i18n %}

{% block main_panel %}
<div class="wide-panel">
    <p class="access-notice">{% trans "Please input the password if you want to browse the shared file/directory." %}</p>
    {% if path %}
    <form action="{% url view_name token %}?p={{ path }}" method="post" id="share-passwd-form">{% csrf_token %}
    {% else %}
    <form action="{% url view_name token %}" method="post" id="share-passwd-form">{% csrf_token %}
    {% endif %}
        <label>{% trans "Password: " %}</label>
        <input type="password" name="password" autofocus />
        <input type="submit" value="{% trans "Submit" %}" />
        {% if err_msg %}
        <p class="error">{{ err_msg }}</p>
        {% endif %}
    </form>
</div>
{% endblock %}
{% block extra_script %}
<script type="text/javascript">
$('#share-passwd-form').submit(function() {
    var form = $(this),
        pwd = $('[name="password"]', form).val(),
        err = $('.error',form);
    if (!$.trim(pwd)) {
        err.html("{% trans "Please enter the password." %}").removeClass('hide');
        return false;
    }
});
</script>
{% endblock %}
