{% load static %} 
{% include "header.html" %}
{% include "navigation.html" with main_path='/main/' %}

<br/>
<br/>

<div class="container">
  <div class="dashboard">
    <div class="span8 offset2">
      <h1>Account and profile</h1>
      <hr>

      <br />
      <h3>Account</h3>
      <form action="/account/" method="POST">
      {% csrf_token %}
      <table class="dashboard">

       <tr>
        <td>
        <b>Account ID</b>
        </td>
        <td>
        {{data.user.username}}
        </td>
       </tr>
      
       <tr>
        <td>
        <b>Account email</b>
        </td>
        <td>
        {% if data.edit == 'email' %}    
          <table class="frametab"><tr><td>
          <input type='hidden' name='edit' value='email' />
          <input type="email" value="{{data.user.email}}" name='value' style='width:95%' required autofocus />
          </td><td>
          <input type="submit" value="Go">
          </td></tr></table>          
        {% else %}
         {{data.user.email}} | <a href="/account/?edit=email">Change</a>
        {% endif %}
        </td>
       </tr>      

       <tr>
        <td>
        <b>Account password</b>
        </td>
        <td>
        {% if data.edit == 'password' %}    
          <table class="frametab"><tr><td>
          <input type='hidden' name='edit' value='password' />
          <input type="password" name='value' style='width:95%' required autofocus />
          </td><td>
          <input type="submit" value="Go">
          </td></tr></table>          
        {% else %}
         ******* | <a href="/account/?edit=password">Change</a>
        {% endif %}
        </td>
       </tr>   

       </table>
       <br />
       
       <h3>Profile</h3>
       <table class="dashboard">
       
       <tr>
        <td>
        <b>Time Zone</b>
        </td>
        <td>
        
        {% if data.edit == 'timezone' %}    
          {% include "components/tzselect.html" %}
          <input type='hidden' name='edit' value='timezone' />
          <input type="submit" value="Go">
        {% else %}
         {{data.profile.timezone}} | <a href="/account/?edit=timezone">Change</a>
        {% endif %}
        </td>
       </tr>
      </table>

      <br />
       <h3>KeyPair</h3>
       <table class="dashboard">
       
       <tr>
        <td valign="top">
        <b>Default public key</b>
        </td>
        <td>
            <pre style="max-width:300px; height:">{{ data.default_public_key }}</pre>
        </td>
       </tr>

      </table>
      </form>
      
      <div style="margin-left:10px; margin-top:40px">
        {% if OPENID_ENABLED %}
        <form action="{% url 'oidc_logout' %}" method="post">
        {% csrf_token %}
        <input type="submit" value="logout">
        </form>
        {% else %}
        <form action="/logout/" method="get">
        <input type="submit" value="logout">
        </form>        
        {% endif %}
      </div>

      
      <br/>
      <br/>
      <br/>
      <br/>
      <br/>
      <br/>
      
    </div>
  </div>
</div>


{% include "footer.html" %}





