{% load bootstrap3 %}

<!-- Modal -->
<div class="modal fade" id="member_useraccount_modal" tabindex="-1" role="dialog" aria-labelledby="new_user_modalLabel"
     aria-hidden="true">
    <div class="modal-dialog" role="document">
        <form action="." method="POST">
            {% csrf_token %}
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="new_user_modalLabel">Account Settings</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true"><i class="fa fa-times"></i> </span>
                    </button>
                </div>
                <div class="modal-body">
                    {% if member_useraccount_form.errors %}
                        {% bootstrap_form_errors member_useraccount_form %}
                    {% endif %}

                    <div class="container-fluid">
                        {% bootstrap_field member_useraccount_form.new_password %}
                        <p>Email or username can be used for login, alongside Facebook connect. Usernames are
                            either generated from Facebook profiles or randomly.</p>
                        <p>Usernames are generally not used and can be safely left alone, they are here for
                            debugging purposes.</p>
                        {% bootstrap_field member_useraccount_form.username %}
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
                    <button type="submit" class="btn btn-primary">Save changes</button>
                </div>
            </div>
        </form>
    </div>
</div>

{# Repoens when there are form errors #}
{% if account_settings_open %}
    <script type="text/javascript">
        $(window).load(function () {
            $('#member_useraccount_modal').modal('show');
        });
    </script>
{% endif %}
