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' %} {% extends 'profile_base.html' %}
{% load i18n %}
{% load bootstrap3 %} {% load bootstrap3 %}
{% block head_title %}{% trans "Account" %}{% endblock %} {% block head_title %}Account{% endblock %}
{% block profile_content %} {% block profile_content %}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<h1>{% trans "E-mail Addresses" %}</h1> <div class="panel panel-default">
{% if user.emailaddress_set.all %} <div class="panel-heading">
<p>{% trans 'The following e-mail addresses are associated with your account:' %}</p> <h4>E-mail Addresses</h4>
</div>
<div class="panel-body">
{% 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"> <form action="{% url 'account_email' %}" class="email_list" method="post">
{% csrf_token %} {% csrf_token %}
<fieldset class="blockLabels"> <fieldset class="blockLabels">
{% for emailaddress in user.emailaddress_set.all %} <table class="table">
<div class="ctrlHolder"> <thead>
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}"> <tr>
<th></th>
<th>Address</th>
<th>Status</th>
<th>Primary?</th>
</tr>
</thead>
<tbody>
{% for emailaddress in user.emailaddress_set.all %}
<tr class="ctrlHolder">
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
<td>
<input <input
id="email_radio_{{forloop.counter}}" id="email_radio_{{forloop.counter}}"
type="radio" type="radio"
@ -31,46 +45,63 @@
checked="checked" checked="checked"
{%endif %} {%endif %}
/> />
</td>
<td>
{{ emailaddress.email }} {{ emailaddress.email }}
</td>
<td>
{% if emailaddress.verified %} {% if emailaddress.verified %}
<span class="badge">{% trans "Verified" %}</span> <span class="label label-success">Verified</span>
{% else %} {% else %}
<span class="badge">{% trans "Unverified" %}</span> <span class="label label-danger">Unverified</span>
{% endif %} {% endif %}
{% if emailaddress.primary %}<span class="badge">{% trans "Primary" %}</span>{% endif %} </td>
<td>
{% if emailaddress.primary %}<span class="label label-primary">Primary</span>{% endif %}
</td>
</label> </label>
</div> </tr>
{% endfor %} {% endfor %}
</tbody>
</table>
<div class="buttonHolder"> <div class="buttonHolder">
<button class="btn btn-black" type="submit" name="action_primary" >{% trans 'Make Primary' %}</button> <button class="btn btn-success" type="submit" name="action_primary" >Make Primary</button>
<button class="btn btn-black" type="submit" name="action_send" >{% trans 'Re-send Verification' %}</button> <button class="btn btn-primary" type="submit" name="action_send" >Re-send Verification</button>
<button class="btn btn-black" type="submit" name="action_remove" >{% trans 'Remove' %}</button> <button class="btn btn-danger" type="submit" name="action_remove" >Remove</button>
</div> </div>
</fieldset> </fieldset>
</form> </form>
{% else %} {% 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> <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 %} {% endif %}
</div>
</div>
<div class="panel panel-default">
<h2>{% trans "Add E-mail Address" %}</h2> <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"> <form method="post" action="{% url 'account_email' %}" class="add_email">
{% csrf_token %} {% csrf_token %}
{% bootstrap_form form %} {% 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> </form>
</div> </div>
</div> </div>
</div>
</div>
<script type="text/javascript"> <script type="text/javascript">
(function() { (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'); var actions = document.getElementsByName('action_remove');
if (actions.length) { if (actions.length) {
actions[0].addEventListener("click", function(e) { actions[0].addEventListener("click", function(e) {

View file

@ -16,7 +16,7 @@
<form class="login" method="POST"> <form class="login" method="POST">
{% csrf_token %} {% csrf_token %}
{% bootstrap_form form %} {% 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 %} {% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" /> <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %} {% endif %}

View file

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

View file

@ -7,14 +7,19 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <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"> <form class="login" method="POST">
{% csrf_token %} {% csrf_token %}
{% bootstrap_form form %} {% 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> </form>
</div> </div>
</div> </div>
</div>
{% endblock %} {% endblock %}

View file

@ -16,7 +16,7 @@
<form class="login" method="POST"> <form class="login" method="POST">
{% csrf_token %} {% csrf_token %}
{% bootstrap_form form %} {% 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> </form>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -13,7 +13,7 @@
<form class="login" method="POST"> <form class="login" method="POST">
{% csrf_token %} {% csrf_token %}
{% bootstrap_form form %} {% 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> </form>
</div> </div>
</div> </div>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,26 +1,61 @@
{% extends 'profile_base.html' %} {% extends 'profile_base.html' %}
{% block profile_content %} {% 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> {% if not profile.description %}
<p class="lead">Apart from Public Credit Name the information in your profile is only visible to team responsible and organisers.</p> <div class="alert alert-danger">
<h3>Your Profile</h3> <p class="lead">
<table class="table table-horisontal"> 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> <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> <td>{{ profile.name|default:"N/A" }}</td>
</tr> </tr>
<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> <td>{{ profile.description|default:"N/A" }}</td>
</tr> </tr>
<tr> <tr>
<td><b>Public Credit Name (visible to the public, leave empty if you want no credits on this website)</b></td> <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> <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>
<tr> <tr>
<td><b>NickServ username (visible to the public on IRC, used to handle team channel ACLs)</b></td> <td>
<td>{{ profile.nickserv_username|default:"N/A" }}</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> </tr>
</table> </table>
<a href="{% url 'profiles:update' %}" class="btn btn-black"><i class="fas fa-edit"></i> Edit Profile</a> </div>
</div>
{% endblock profile_content %} {% endblock profile_content %}

View file

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