blob: 2efb388fbca764b1295c0c8abe72758d50d6031e [file] [log] [blame]
{#-
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-#}
{% set hide_left_bar = True %}
{% extends g.theme.master %}
{% block title %}{{c.user.username}} / Preferences{% endblock %}
{% block header %}User Preferences for {{c.user.username}}{% endblock %}
{% block content %}
<ul id="account-nav-menu" class="b-hornav droppy">
{% for item in menu -%}
<li id="{{ item.tabid }}">
<a href="{{ item.target }}">
{{ item.title }}
<div class="marker{% if item.target.rstrip('/') == request.path.rstrip('/') %} current{% endif %}"></div>
</a>
</li>
{%- endfor %}
</ul>
<div class="grid-23">
<h2>Preferences</h2>
<form action="update" method="post">
{% if tg.config.get('auth.method', 'local') == 'local' %}
<label class="grid-4">Display Name</label>
<div class="grid-18">
<input name="preferences.display_name" value="{{c.user.display_name}}" type="text">
</div>
<label class="grid-4">Page Size</label>
<div class="grid-18">
<select name="preferences.results_per_page">
{% for per_page in [25, 50, 100, 250] %}
<option {% if per_page == c.user.preferences.results_per_page %}selected="selected"{% endif %}
value="{{per_page}}">{{per_page}}</option>
{% endfor %}
</select>
</div>
{% endif %}
{% if tg.config.get('auth.method', 'local') == 'local' %}
{% for a in c.user.email_addresses %}
<input name="addr-{{loop.index0}}.ord" value="{{loop.index0}}" type="hidden"/>
{% endfor %}
{% if c.user.email_addresses %}
<h3 class="grid-18">Email Addresses</h3>
<table class="grid-18">
<tr>
<th>Primary?</th>
<th>Address</th>
<th>Confirmed</th>
<th></th>
</tr>
{% for a in c.user.email_addresses %}
<tr>
{% set obj = c.user.address_object(a) %}
<td>{{lib.radio_button('primary_addr', None, a, c.user.preferences.email_address)}}</td>
<td>{{a}}</td>
{% if obj %}
<td>
{% if obj.confirmed %}
yes
{% else %}
no (<a href="{{g.url('/auth/send_verification_link', a=a)}}">verify</a>)
{% endif %}
</td>
{% else %}
<td>Unknown addr obj {{a}}</td>
{% endif %}
<td>{{lib.submit_button('Delete', 'addr-%s.delete' % loop.index0)}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
<div class="grid-18">
{{lib.text_field('new_addr.addr', 'New Email Address')}}
{{lib.submit_button('Claim Address', name='new_addr.claim')}}
</div>
{% if c.user.open_ids %}
<h3 class="grid-18">OpenIDs Claimed</h3>
<table class="grid-18">
<tr>
<th>OpenID</th>
<th></th>
</tr>
{% for oid in c.user.open_ids %}
{% set obj = c.user.openid_object(oid) %}
<tr>
<td>{{oid}}</td>
<td>{{lib.submit_button('Delete', 'oid-%s.delete' % loop.index0)}}</td>
</tr>
{% endfor %}
</table>
{% endif %}
<div class="grid-18">
<a href="/auth/claim_oid">Claim New OpenID</a>
</div>
{% endif %}
<div class="grid-18">
{{lib.submit_button('Save Changes')}}
</div>
</form>
</div>
<div style="clear:both"></div>
{% if g.theme.password_change_form %}
<div class="grid-20">
<h2>Change Password</h2>
{{ g.theme.password_change_form.display() }}
</div>
{% endif %}
{% if g.theme.upload_key_form %}
<div class="grid-20">
<h2>Upload ssh public key</h2>
{{ g.theme.upload_key_form.display() }}
</div>
{% endif %}
{% if tg.config.get('auth.method', 'local') == 'local' %}
<div class="grid-20">
<h2>API Token</h2>
{% if api_token %}
<p>
<b>API Key:</b><br/>
{{api_token.api_key}}<br/>
<b>Secret Key:</b><br/>
{{api_token.secret_key}}<br/>
</p>
<form method="POST" action="del_api_token" class="grid-18">
<input type="submit" value="Delete API Token">
</form>
{% else %}
<p>No API token generated</p>
{% endif %}
<form method="POST" action="gen_api_token" class="grid-18">
<input type="submit" value="(Re)generate API Token">
</form>
</div>
{% endif %}
{% endblock %}