pagure-new/pagure/templates/user_settings.html

123 lines
4.4 KiB
HTML

{% extends "master.html" %}
{% from "_formhelper.html" import render_bootstrap_field %}
{% block title %}{{ user.user }}'s settings{% endblock %}
{% set tag = "users"%}
{% macro render_email(email, form, validated=True) %}
<div class="list-group-item {% if not validated %}disabled{% endif %}">
<span class="oi" data-glyph="envelope-closed"></span> &nbsp;{{ email.email }}
{% if validated %}
<form class="pull-xs-right" method="POST"
action="{{ url_for('remove_user_email') }}">
<input type="hidden" value="{{ email.email }}" name="email" />
{{ form.csrf_token }}
<button
onclick="return confirm('Do you really want to remove the email: {{ email.email }}?');"
title="Remove email" class="btn btn-sm btn-danger">
<span class="oi" data-glyph="trash"></span>
</button>
</form>
{% if email.email == user.default_email %}
<span class="text-muted pull-xs-right p-r-1">
<span class="oi" data-glyph="star" title="default email address" data-toggle="tooltip"></span>
</span>
{% else %}
<form style="display:inline;" method="POST"
action="{{ url_for('set_default_email') }}" id="default_mail">
<input type="hidden" value="{{ email.email }}" name="email" />
{{ form.csrf_token }}
<a class="pull-xs-right p-r-1" href="javascript:void(0);"
onclick="$(this).closest('form').submit();"
title="Set default email address">
<small>set as default</small>
</a>
</form>
{% endif %}
{% else %}
<div class="pull-xs-right">
<small>pending verification via email</small>
<form style="display:inline;" method="POST"
action="{{ url_for('reconfirm_email') }}" id="reconfirm_mail">
<input type="hidden" value="{{ email.email }}" name="email" />
{{ form.csrf_token }}
<button
onclick="$(this).closest('form').submit();"
title="Resend validation email" class="btn btn-sm btn-warning">
<span class="oi" data-glyph="loop-circular"></span>
</button>
</form>
</div>
{% endif %}
</div>
{% endmacro %}
{% block content %}
<div class="container p-t-3">
<div class="col-md-8 col-md-offset-2">
<div class="card m-b-3">
<div class="card-header">
Basic Information
</div>
<div class="card-block">
<fieldset class="form-group">
<label for="description"><strong>Username</strong></label>
<div>{{ user.user }}</div>
</fieldset>
<fieldset class="form-group">
<label for="description"><strong>Full Name</strong></label>
<div>{{ user.fullname }}</div>
</fieldset>
<fieldset class="form-group">
<label for="description"><strong>Avatar</strong></label>
<div>
<a> {{ g.fas_user.username | avatar(80) | safe }} </a>
<a class="btn btn-primary" href="https://www.libravatar.org/account/login/">
Change Avatar </a>
</div>
</fieldset>
</div>
</div>
<div class="card m-b-3">
<div class="card-header">
<strong>Email Addresses</strong>
<a class="btn btn-success btn-sm pull-xs-right" href="{{ url_for('add_user_email') }}">
Add Email
</a>
</div>
<div class="list-group list-group-flush">
{% for email in user.emails %}
{{ render_email(email, form) }}
{% endfor %}
{% for email in user.emails_pending %}
{{ render_email(email, form, validated=False) }}
{% endfor %}
</div>
</div>
<div class="card m-b-3">
<div class="card-header">
<strong>Authentication</strong>
</div>
<div class="card-block">
<form action="{{ url_for('user_settings') }}" method="post">
{{ render_bootstrap_field(form.ssh_key) }}
<p class="buttons indent">
<input type="submit" class="btn btn-primary" value="Update">
<input type="button" class="btn btn-secondary" value="Cancel" class="button" onclick="history.back();">
{{ form.csrf_token }}
</p>
</form>
</div>
</div>
<div class="card m-b-3">
{% if config.get('PAGURE_AUTH')=='local' %}
<a href="{{ url_for('change_password', username=g.fas_user.username) }}">Change password</a>
{% endif %}
</div>
</div>
</div>
{% endblock %}