{% extends "base.html" %}
{% load i18n %}
{% load tags_fingerprint %}
{% block title %}{% trans "Profile" %}{% endblock %}
{% block content %}
            <!-- Page Heading -->
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-header">{% trans "Profile" %}</h1>
                </div>
            </div>
            <!-- /.row -->

            {% include 'errors_block.html' %}

            <div class="row">
                <div class="col-lg-12">
                    <h3 class="page-header">{% trans "Edit Profile" %}</h3>
                    <form class="form-horizontal" method="post" action="" role="form">{% csrf_token %}
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{% trans "Login" %}</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" value="{{ request.user.username }}" disabled>
                            </div>
                        </div>
                        <div class="form-group bridge_name_form_group_dhcp">
                            <label class="col-sm-2 control-label">{% trans "Username" %}</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" name="username" value="{{ request.user.first_name }}" pattern="[0-9a-zA-Z]+">
                            </div>
                        </div>
                        <div class="form-group bridge_name_form_group_dhcp">
                            <label class="col-sm-2 control-label">{% trans "Email" %}</label>
                            <div class="col-sm-4">
                                <input type="email" class="form-control" name="email" value="{{ request.user.email }}">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-primary">{% trans "Change" %}</button>
                            </div>
                        </div>
                    </form>
                    {% if show_profile_edit_password %}
                    <h3 class="page-header">{% trans "Edit Password" %}</h3>
                    <form class="form-horizontal" method="post" action="" role="form">{% csrf_token %}
                        <div class="form-group">
                            <label class="col-sm-2 control-label">{% trans "Old" %}</label>
                            <div class="col-sm-4">
                                <input type="password" class="form-control" name="oldpasswd" value="">
                            </div>
                        </div>
                        <div class="form-group bridge_name_form_group_dhcp">
                            <label class="col-sm-2 control-label">{% trans "New" %}</label>
                            <div class="col-sm-4">
                                <input type="password" class="form-control" name="passwd1" value="">
                            </div>
                        </div>
                        <div class="form-group bridge_name_form_group_dhcp">
                            <label class="col-sm-2 control-label">{% trans "Retry" %}</label>
                            <div class="col-sm-4">
                                <input type="password" class="form-control" name="passwd2" value="">
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-primary">{% trans "Change" %}</button>
                            </div>
                        </div>
                    </form>
                    {% endif %}
                    <h3 class="page-header">{% trans "SSH Keys" %}</h3>
                    {% if publickeys %}
                        <div class="col-lg-12">
                            <div class="table-responsive">
                                <table class="table table-hover">
                                    <tbody style="text-align: center;">
                                    {% for key in publickeys %}
                                        <tr>
                                            <td>{{ key.keyname }} ({% ssh_to_fingerprint key.keypublic %})</td>
                                             <td>
                                                <form action="" method="post" role="form">{% csrf_token %}
                                                    <input type="hidden" name="keyid" value="{{ key.id }}"/>
                                                    <button type="submit" class="btn btn-sm btn-default" name="keydelete" title="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure?" %}')">
                                                        <span class="glyphicon glyphicon-trash"></span>
                                                    </button>
                                                </form>
                                            </td>
                                        </tr>
                                    {% endfor %}
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    {% endif %}
                    <form class="form-horizontal" method="post" action="" role="form">{% csrf_token %}
                        <div class="form-group bridge_name_form_group_dhcp">
                            <label class="col-sm-2 control-label">{% trans "Key name" %}</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" name="keyname" placeholder="{% trans "Enter Name" %}">
                            </div>
                        </div>
                        <div class="form-group bridge_name_form_group_dhcp">
                            <label class="col-sm-2 control-label">{% trans "Public key" %}</label>
                            <div class="col-sm-8">
                                <textarea name="keypublic" class="form-control" rows="6" placeholder="{% trans "Enter Public Key" %}"></textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-primary">{% trans "Add" %}</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
{% endblock %}
