Big big overhaul.

This commit is contained in:
Víðir Valberg Guðmundsson 2019-03-26 12:14:54 +01:00
parent 8025303b57
commit 8c4d99d9e8
13 changed files with 268 additions and 161 deletions

View file

@ -1,27 +1,41 @@
{% extends 'profile_base.html' %}
{% load i18n %}
{% load bootstrap3 %}
{% block head_title %}{% trans "Account" %}{% endblock %}
{% block head_title %}Account{% endblock %}
{% block profile_content %}
<div class="row">
<div class="row">
<div class="col-md-12">
<h1>{% trans "E-mail Addresses" %}</h1>
{% if user.emailaddress_set.all %}
<p>{% trans 'The following e-mail addresses are associated with your account:' %}</p>
<div class="panel panel-default">
<div class="panel-heading">
<h4>E-mail Addresses</h4>
</div>
<div class="panel-body">
<form action="{% url 'account_email' %}" class="email_list" method="post">
{% csrf_token %}
<fieldset class="blockLabels">
{% if user.emailaddress_set.all %}
<p>The following e-mail addresses are associated with your account:</p>
<form action="{% url 'account_email' %}" class="email_list" method="post">
{% csrf_token %}
<fieldset class="blockLabels">
<table class="table">
<thead>
<tr>
<th></th>
<th>Address</th>
<th>Status</th>
<th>Primary?</th>
</tr>
</thead>
<tbody>
{% for emailaddress in user.emailaddress_set.all %}
<div class="ctrlHolder">
<tr class="ctrlHolder">
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
<td>
<input
id="email_radio_{{forloop.counter}}"
type="radio"
@ -31,46 +45,63 @@
checked="checked"
{%endif %}
/>
{{ emailaddress.email }}
</td>
<td>
{{ emailaddress.email }}
</td>
<td>
{% if emailaddress.verified %}
<span class="badge">{% trans "Verified" %}</span>
<span class="label label-success">Verified</span>
{% else %}
<span class="badge">{% trans "Unverified" %}</span>
<span class="label label-danger">Unverified</span>
{% endif %}
{% if emailaddress.primary %}<span class="badge">{% trans "Primary" %}</span>{% endif %}
</label>
</div>
</td>
<td>
{% if emailaddress.primary %}<span class="label label-primary">Primary</span>{% endif %}
</td>
</label>
</tr>
{% endfor %}
<div class="buttonHolder">
<button class="btn btn-black" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button>
<button class="btn btn-black" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button>
<button class="btn btn-black" type="submit" name="action_remove" >{% trans 'Remove' %}</button>
</div>
</tbody>
</table>
</fieldset>
</form>
<div class="buttonHolder">
<button class="btn btn-success" type="submit" name="action_primary" >Make Primary</button>
<button class="btn btn-primary" type="submit" name="action_send" >Re-send Verification</button>
<button class="btn btn-danger" type="submit" name="action_remove" >Remove</button>
</div>
{% else %}
<p><strong>{% trans 'Warning:'%}</strong> {% trans "You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc." %}</p>
{% endif %}
<h2>{% trans "Add E-mail Address" %}</h2>
</fieldset>
</form>
{% else %}
<p>
<strong>Warning:</strong> You currently do not have any e-mail address set up. You should really add an e-mail address so you can receive notifications, reset your password, etc.
</p>
{% endif %}
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4>Add E-mail Address</h4>
</div>
<div class="panel-body">
<form method="post" action="{% url 'account_email' %}" class="add_email">
{% csrf_token %}
{% bootstrap_form form %}
<button name="action_add" class="btn btn-black" type="submit">{% trans "Add E-mail" %}</button>
<button name="action_add" class="btn btn-success" type="submit">Add E-mail</button>
</form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
(function() {
var message = "{% trans 'Do you really want to remove the selected e-mail address?' %}";
var message = "Do you really want to remove the selected e-mail address?";
var actions = document.getElementsByName('action_remove');
if (actions.length) {
actions[0].addEventListener("click", function(e) {

View file

@ -16,7 +16,7 @@
<form class="login" method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button class="form-control btn btn-black" type="submit">{% trans "Login" %}</button>
<button class="form-control btn btn-primary" type="submit">{% trans "Login" %}</button>
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}

View file

@ -10,7 +10,7 @@
<form method="post">
{% csrf_token %}
<button type="submit"
class="btn btn-black form-control">
class="btn btn-danger form-control">
Logout
</button>
</form>

View file

@ -7,14 +7,19 @@
<div class="row">
<div class="col-md-12">
<h1>Change password</h1>
<div class="panel panel-default">
<div class="panel-heading">
<h4>Change Password</h4>
</div>
<div class="panel-body">
<form class="login" method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button class="form-control btn btn-black" type="submit">Save</button>
<button class="form-control btn btn-primary" type="submit">Save</button>
</form>
</div>
</div>
</div>
{% endblock %}

View file

@ -16,7 +16,7 @@
<form class="login" method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button class="form-control btn btn-black" type="submit">Send e-mail</button>
<button class="form-control btn btn-primary" type="submit">Send e-mail</button>
</form>
</div>
{% endblock %}

View file

@ -13,7 +13,7 @@
<form class="login" method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button class="form-control btn btn-black" type="submit">{% trans "Sign Up" %}</button>
<button class="form-control btn btn-success" type="submit">{% trans "Sign Up" %}</button>
</form>
</div>
</div>

View file

@ -15,7 +15,7 @@
{% bootstrap_form form %}
<button type="submit"
class="btn btn-black form-control">
class="btn btn-primary form-control">
{% trans 'Authenticate' %}
</button>
</form>

View file

@ -2,34 +2,49 @@
{% load account %}
{% load bootstrap3 %}
{% load i18n %}
{% block profile_content %}
<div class="row">
<div class="col-md-12">
<h1>
{% trans "Two-Factor Authentication Backup Tokens" %}
</h1>
<div class="panel panel-default">
<div class="panel-heading">
<h4>Two-Factor Authentication Backup Tokens</h4>
</div>
<div class="panel-body">
{% if backup_tokens %}
<ul>
{% for token in backup_tokens %}
<li>{{ token.token }}</li>
{% empty %}
{% trans 'No tokens. Press the button below to generate some.' %}
{% endfor %}
</ul>
{% else %}
<p>No tokens. Press the button below to generate some.</p>
{% endif %}
<form method="post">
{% csrf_token %}
<div class="buttonHolder">
<button class="btn btn-black" type="submit">
{% trans 'Generate backup tokens' %}
<button class="btn btn-success" type="submit">
{% if backup_tokens %}
Generate new backup tokens
{% else %}
Generate new backup tokens
{% endif %}
</button>
<a class="btn btn-warning" href="{% url 'two-factor-remove' %}">Disable Two-Factor</a>
</div>
</form>
</div>
</div>
<div class="panel panel-danger">
<div class="panel-heading">
<h4>Disable Two-Factor Authenticatoin</h4>
</div>
<div class="panel-body">
<a class="btn btn-danger" href="{% url 'two-factor-remove' %}">Disable Two-Factor</a>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -2,23 +2,26 @@
{% load account %}
{% load bootstrap3 %}
{% load i18n %}
{% block profile_content %}
<div class="row">
<div class="col-md-12">
<h1>
{% trans "Disable Two-Factor Authentication" %}
</h1>
<p>{% trans "Are you sure?" %}</p>
<div class="panel panel-danger">
<div class="panel-heading">
<h4>Disable Two-Factor Authentication</h4>
</div>
<div class="panel-body">
<p>Are you sure you want to disable two-factor authentication?</p>
<form method="post">
{% csrf_token %}
<button class="btn btn-danger" type="submit">
{% trans 'Disable Two-Factor' %}
Yes, I'm sure
</button>
<a href="{% url 'two-factor-backup-tokens' %}" class="btn btn-success">No, I've changed my mind.</a>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -7,10 +7,11 @@
{% block profile_content %}
<div class="row">
<div class="col-md-12">
<h1>
{% trans "Setup Two-Factor Authentication" %}
</h1>
<div class="panel panel-default">
<div class="panel-heading">
<h4>Setup Two-Factor Authentication</h4>
</div>
<div class="panel-body">
<h4>
{% trans 'Step 1' %}:
</h4>
@ -32,10 +33,12 @@
<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
<button class="btn btn-black" type="submit">
<button class="btn btn-success" type="submit">
{% trans 'Verify' %}
</button>
</form>
</div>
</div>
</div>
</div>
{% endblock %}

View file

@ -5,64 +5,78 @@
{% block content %}
<div class="page-header">
<h2>Your BornHack account</h2>
</div>
<div class="row">
<div class="col-md-2">
<ul class="nav nav-pills nav-stacked">
<li {% if view.active_menu == "profile" %}class="active"{% endif %}>
<a href="{% url 'profiles:detail' %}">
<li><b>Profile settings</b></li>
{% url 'profiles:detail' as profile_detail_url %}
<li {% if request.path == profile_detail_url %}class="active"{% endif %}>
<a href="{{ profile_detail_url }}">
Profile
</a>
</li>
<li {% if view.active_menu == "profile" %}class="active"{% endif %}>
<a href="{% url 'account_change_password' %}">
{% url 'account_change_password' as password_url %}
<li {% if request.path == password_url %}class="active"{% endif %}>
<a href="{{ password_url }}">
Password
</a>
</li>
<li {% if view.active_menu == "profile" %}class="active"{% endif %}>
<a href="{% url 'two-factor-setup' %}">
Two-Factor settings
</a>
</li>
<li {% if view.active_menu == "profile" %}class="active"{% endif %}>
<a href="{% url 'account_email' %}">
{% url 'account_email' as email_url %}
<li {% if request.path == email_url %}class="active"{% endif %}>
<a href="{{ email_url }}">
Manage emails
</a>
</li>
{% url 'two-factor-setup' as two_factor_url %}
<li {% if "two_factor" in request.path %}class="active"{% endif %}>
<a href="{{ two_factor_url }}">
Two-Factor settings
</a>
</li>
{% if user.orders.exists %}
<li {% if view.active_menu == "profile" %}class="active"{% endif %}>
<li><b>Shop</b></li>
<li {% if view.active_menu == "orders" %}class="active"{% endif %}>
<a href="{% url 'shop:order_list' %}">
Orders
</a>
</li>
<li {% if view.active_menu == "profile" %}class="active"{% endif %}>
<li {% if view.active_menu == "tickets" %}class="active"{% endif %}>
<a href="{% url 'tickets:shopticket_list' %}">
Tickets
</a>
</li>
{% if user.creditnotes.exists %}
<li {% if view.active_menu == "profile" %}class="active"{% endif %}>
<li {% if view.active_menu == "credit_notes" %}class="active"{% endif %}>
<a href="{% url 'shop:creditnote_list' %}">
Credit Notes
</a>
</li>
{% endif %}
{% endif %}
<li {% if view.active_menu == "profile" %}class="active"{% endif %}>
<li><b>Misc.</b></li>
<li {% if view.active_menu == "tokens" %}class="active"{% endif %}>
<a href="{% url 'tokens:tokenfind_list' %}">
Secret Tokens
</a>
</li>
<p><b>You are logged in as {{ request.user.email }}</b></p>
<hr />
<p><b>You are logged in as {{ request.user.email }}</b></p>
</ul>
</div>

View file

@ -1,26 +1,61 @@
{% extends 'profile_base.html' %}
{% block profile_content %}
<p class="lead">If you intend to join one or more teams you can use the profile to help the team responsible understand who you are and what you have to offer. Please also include availability if you are not joining us for the entire week.</p>
<p class="lead">Apart from Public Credit Name the information in your profile is only visible to team responsible and organisers.</p>
<h3>Your Profile</h3>
<table class="table table-horisontal">
{% if not profile.description %}
<div class="alert alert-danger">
<p class="lead">
Attention!
</p>
<p>
You have not written anything in your "description".
</p>
<p>
If you intend to join one or more teams you can use the profile to help the team responsible understand who you are and what you have to offer. Please also include availability if you are not joining us for the entire week.
</p>
</div>
{% endif %}
<div class="panel panel-default">
<div class="panel-heading">
<a href="{% url 'profiles:update' %}" class="btn btn-primary pull-right clearfix"><i class="fas fa-edit"></i> Edit Profile</a>
<h4>Your information</h4>
</div>
<div class="panel-body">
<table class="table table-striped">
<tr>
<td><b>Name (not visible to the public)</b></td>
<td>
<b>Name</b><br />
<small>(not visible to the public)</small></td>
<td>{{ profile.name|default:"N/A" }}</td>
</tr>
<tr>
<td><b>Description (not visible to the public)</b></td>
<td>
<b>Description</b><br />
<small>(not visible to the public)</small>
</td>
<td>{{ profile.description|default:"N/A" }}</td>
</tr>
<tr>
<td><b>Public Credit Name (visible to the public, leave empty if you want no credits on this website)</b></td>
<td>{{ profile.public_credit_name|default:"N/A" }} {% if profile.public_credit_name %}({% if profile.public_credit_name_approved %}<span class="text-success">approved</span>{% else %}<span class="text-danger">pending approval</span>{% endif %}){% endif %}</td>
<td>
<b>Public Credit Name</b><br />
<small>(visible to the public, leave empty if you want no credits on this website)</small>
</td>
<td>
{{ profile.public_credit_name|default:"N/A" }} {% if profile.public_credit_name %}({% if profile.public_credit_name_approved %}<span class="text-success">approved</span>{% else %}<span class="text-danger">pending approval</span>{% endif %}){% endif %}</td>
</tr>
<tr>
<td><b>NickServ username (visible to the public on IRC, used to handle team channel ACLs)</b></td>
<td>{{ profile.nickserv_username|default:"N/A" }}</td>
<td>
<b>NickServ username</b><br />
<small>(visible to the public on IRC, used to handle team channel ACLs)</small>
</td>
<td>
{{ profile.nickserv_username|default:"N/A" }}
</td>
</tr>
</table>
<a href="{% url 'profiles:update' %}" class="btn btn-black"><i class="fas fa-edit"></i> Edit Profile</a>
</table>
</div>
</div>
{% endblock profile_content %}

View file

@ -9,6 +9,7 @@ from . import models
class ProfileDetail(LoginRequiredMixin, DetailView):
model = models.Profile
template_name = 'profile_detail.html'
active_menu = 'profile'
def get_object(self, queryset=None):
return models.Profile.objects.get(user=self.request.user)