Signup about done. Also enabled apps again.

This commit is contained in:
Víðir Valberg Guðmundsson 2016-02-20 03:00:08 +01:00
parent 0d96243876
commit 1de0b1ad0e
15 changed files with 299 additions and 86 deletions

View file

@ -25,8 +25,8 @@ INSTALLED_APPS = [
'allauth.account',
'bootstrap3',
# 'profiles',
# 'camps',
'profiles',
'camps',
]
STATIC_URL = '/static/'
@ -79,6 +79,6 @@ AUTHENTICATION_BACKENDS = (
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = True
ACCOUNT_EMAIL_SUBJECT_PREFIX = '[bornhack]'
ACCOUNT_EMAIL_SUBJECT_PREFIX = '[bornhack] '
ACCOUNT_USERNAME_REQUIRED = False
LOGIN_URL = '/login/'

View file

@ -2,6 +2,10 @@ body {
margin-top: 90px;
}
* {
border-radius: 0 !important;
}
a, a:active, a:focus {
outline: none;
}

View file

@ -4,23 +4,25 @@
{% load account %}
{% load bootstrap3 %}
{% block body_class %}{{ block.super }} narrow{% endblock %}
{% block content %}
<h1>{% trans "Login" %}</h1>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1>{% trans "Login" %}</h1>
<p>{% blocktrans %}If you have not created an account yet, then please
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
<p>{% blocktrans %}If you have not created an account yet, then please
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
<form class="login" method="POST" action="{% url 'account_login' %}">
{% csrf_token %}
{% bootstrap_form form %}
<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 %}
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
</form>
<form class="login" method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button class="form-control btn btn-black" type="submit">{% trans "Login" %}</button>
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<a class="button secondaryAction" href="{% url 'account_reset_password' %}">{% trans "Lost Password?" %}</a>
</form>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,22 @@
{% extends "base.html" %}
{% load account %}
{% load bootstrap3 %}
{% block content %}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1>Lost your password?</h1>
<p>
Lost your password? Input your email, and we will send you an e-mail
with instructions for resetting your password.
</p>
<form class="login" method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button class="form-control btn btn-black" type="submit">Send e-mail</button>
</form>
</div>
{% endblock %}

View file

@ -0,0 +1,14 @@
{% extends "base.html" %}
{% load account %}
{% block content %}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1>Reset e-mail sent</h1>
<p>
We have now sent an e-mail with instructions for how to reset your
password.
</p>
</div>
{% endblock %}

View file

@ -0,0 +1,31 @@
{% extends "base.html" %}
{% load account %}
{% load bootstrap3 %}
{% block content %}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1>{% if token_fail %}Invalidt link{% else %}Reset password{% endif %}</h1>
{% if token_fail %}
<p>
The given token is invalid.
</p>
<p>
<a href="{% url 'account_reset_password' %}" class="btn btn-primary">Request new reset</a>
</p>
{% else %}
{% if form %}
<form class="login" method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button class="form-control btn btn-black" type="submit">Reset password</button>
</form>
{% else %}
<p>Your password has been reset</p>
{% endif %}
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,15 @@
{% extends "base.html" %}
{% load account %}
{% block content %}
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1>Password reset</h1>
<p>
Your password has been reset. You can now <a href="{% url 'account_login' %}">login</a>
</p>
</div>
{% endblock %}

View file

@ -1,18 +1,21 @@
{% extends 'base.html' %}
{% load bootstrap3 %}
{% extends "base.html" %}
{% block body_class %}{{ block.super }} narrow{% endblock %}
{% load i18n %}
{% load account %}
{% load bootstrap3 %}
{% block content %}
<div class="cover">
<form method="post" class="signup-form">
{% csrf_token %}
{% bootstrap_form form %}
<button type="submit" class="btn btn-primary btn-lg">
Signup
</button>
</form>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<h1>{% trans "Signup" %}</h1>
<form class="login" method="POST">
{% csrf_token %}
{% bootstrap_form form %}
<button class="form-control btn btn-black" type="submit">{% trans "Sign Up" %}</button>
</form>
</div>
</div>
{% endblock %}

View file

@ -33,9 +33,15 @@
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav pull-right">
<li><a href="#sign-up">Sign up</a></li>
<li><a href="#FAQ">FAQ</a></li>
<li><a href="https://wiki.bornhack.dk">Wiki</a></li>
{% if user.is_authenticated %}
<li><a href="{% url 'profiles:detail' %}">Profile</a></li>
<li><a href="{% url 'account_logout' %}">Logout</a></li>
{% else %}
<li><a href="{% url 'account_login' %}">Login</a></li>
<li><a href="{% url 'account_signup' %}">Sign up</a></li>
{% endif %}
</ul>
</div>
</div>

View file

@ -1,11 +1,11 @@
# from allauth.account.views import (
# SignupView,
# LoginView,
# LogoutView,
# ConfirmEmailView,
# EmailVerificationSentView,
# PasswordResetView
# )
from allauth.account.views import (
SignupView,
LoginView,
LogoutView,
ConfirmEmailView,
EmailVerificationSentView,
PasswordResetView
)
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
@ -16,40 +16,41 @@ urlpatterns = [
TemplateView.as_view(template_name='frontpage.html'),
name='frontpage'
),
# url(
# r'^login/$',
# LoginView.as_view(),
# name='account_login',
# ),
# url(
# r'^logout/$',
# LogoutView.as_view(),
# name='account_logout',
# ),
# url(
# r'^confirm/(?P<key>\S+)$',
# ConfirmEmailView.as_view(),
# name='account_confirm_email',
# ),
# url(
# r'^signup/done/$',
# EmailVerificationSentView.as_view(),
# name='account_email_verification_sent',
# ),
# url(
# r'^signup/$',
# SignupView.as_view(),
# name='account_signup',
# ),
# url(
# r'^reset-password/$',
# PasswordResetView.as_view(),
# name='account_reset_password',
# ),
# url(
# r'^profile/',
# include('profiles.urls', namespace='profiles')
# ),
#url(
#r'^login/$',
#LoginView.as_view(),
#name='account_login',
#),
url(
r'^logout/$',
LogoutView.as_view(),
name='account_logout',
),
#url(
#r'^confirm/(?P<key>\S+)$',
#ConfirmEmailView.as_view(),
#name='account_confirm_email',
#),
#url(
#r'^signup/done/$',
#EmailVerificationSentView.as_view(),
#name='account_email_verification_sent',
#),
#url(
#r'^signup/$',
#SignupView.as_view(),
#name='account_signup',
#),
#url(
#r'^reset-password/$',
#PasswordResetView.as_view(),
#name='account_reset_password',
#),
url(
r'^profile/',
include('profiles.urls', namespace='profiles')
),
url(r'^accounts/', include('allauth.urls')),
url(r'^admin/', include(admin.site.urls)),
]

View file

@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import uuid
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Camp',
fields=[
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('uuid', models.UUIDField(default=uuid.uuid4, serialize=False, editable=False, primary_key=True)),
('name', models.CharField(max_length=255, help_text='Name of the camp, ie. Bornhack.', verbose_name='Name')),
('start', models.DateTimeField(help_text='When the camp starts.', unique=True, verbose_name='Start date')),
('end', models.DateTimeField(help_text='When the camp ends.', unique=True, verbose_name='End date')),
],
options={
'verbose_name_plural': 'Camps',
'verbose_name': 'Camp',
},
),
migrations.CreateModel(
name='Day',
fields=[
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('uuid', models.UUIDField(default=uuid.uuid4, serialize=False, editable=False, primary_key=True)),
('date', models.DateField(help_text='What date?', verbose_name='Date')),
('camp', models.ForeignKey(to='camps.Camp', help_text='Which camp does this day belong to.', verbose_name='Camp')),
],
options={
'verbose_name_plural': 'Days',
'verbose_name': 'Day',
},
),
migrations.CreateModel(
name='Expense',
fields=[
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('uuid', models.UUIDField(default=uuid.uuid4, serialize=False, editable=False, primary_key=True)),
('description', models.CharField(max_length=255, help_text='What this expense covers.', verbose_name='Description')),
('amount', models.DecimalField(max_digits=7, help_text='The amount of the expense.', verbose_name='Amount', decimal_places=2)),
('currency', models.CharField(max_length=3, choices=[('btc', 'BTC'), ('dkk', 'DKK'), ('eur', 'EUR'), ('sek', 'SEK')], help_text='What currency the amount is in.', verbose_name='Currency')),
('camp', models.ForeignKey(to='camps.Camp', help_text='The camp to which this expense relates to.', verbose_name='Camp')),
('covered_by', models.ForeignKey(to=settings.AUTH_USER_MODEL, blank=True, help_text='Which user, if any, covered this expense.', verbose_name='Covered by', null=True)),
],
options={
'verbose_name_plural': 'Expenses',
'verbose_name': 'Expense',
},
),
migrations.CreateModel(
name='Signup',
fields=[
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('uuid', models.UUIDField(default=uuid.uuid4, serialize=False, editable=False, primary_key=True)),
('cost', models.DecimalField(default=1500.0, decimal_places=2, help_text='What the user should/is willing to pay for this signup.', verbose_name='Cost', max_digits=7)),
('paid', models.BooleanField(help_text='Whether the user has paid.', verbose_name='Paid?', default=False)),
('camp', models.ForeignKey(to='camps.Camp', help_text='The camp that has been signed up for.', verbose_name='Camp')),
('user', models.ForeignKey(to=settings.AUTH_USER_MODEL, help_text='The user that has signed up.', verbose_name='User')),
],
options={
'verbose_name_plural': 'Signups',
'verbose_name': 'Signup',
},
),
]

View file

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-17 17:18
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('camps', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='day',
name='camp',
field=models.ForeignKey(help_text='Which camp does this day belong to.', on_delete=django.db.models.deletion.CASCADE, related_name='days', to='camps.Camp', verbose_name='Camp'),
),
]

View file

@ -1,10 +0,0 @@
{% extends 'base.html' %}
{% block content %}
<form method="post">
{{ form }}
<button type="submit">Signup</button>
</form>
{% endblock %}

View file

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import uuid
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Profile',
fields=[
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('uuid', models.UUIDField(serialize=False, editable=False, primary_key=True, default=uuid.uuid4)),
('user', models.OneToOneField(to=settings.AUTH_USER_MODEL, help_text='The django user this profile belongs to.', verbose_name='User')),
],
options={
'verbose_name_plural': 'Profiles',
'verbose_name': 'Profile',
},
),
]

View file

@ -5,8 +5,5 @@
<p class="lead">
Yeah! You now have a BornHack user!
</p>
<p>
You have also been added to our announcement mailing list. It is on this list that we will announce more information about the camp.
</p>
</div>
{% endblock %}