From 81dba3e6b38b16dc794c0114837e3651f1b98a77 Mon Sep 17 00:00:00 2001 From: gw3000 Date: Sun, 11 Jun 2023 13:52:42 +0200 Subject: [PATCH] accounts, add modal and many more --- core/settings.py | 29 +++++++ core/urls.py | 6 ++ fbf/README.md | 6 ++ fbf/templates/fbf/bird_all.html | 46 ++++++++++- fbf/templates/fbf/bird_create.html | 39 +++++++++ fbf/views.py | 45 ++++++++++- requirements.txt | 1 + rescuer/README.md | 8 ++ rescuer/models.py | 2 - rescuer/templates/rescuer/rescuer_create.html | 55 +++++++++++++ rescuer/urls.py | 3 +- rescuer/views.py | 5 ++ sites/templates/sites/index.html | 20 +++++ sites/urls.py | 9 +++ sites/views.py | 14 +++- static/css/style.css | 7 ++ templates/account/account_inactive.html | 12 +++ templates/account/base.html | 40 +++++++++ templates/account/email.html | 81 +++++++++++++++++++ templates/account/email/base_message.txt | 7 ++ .../email/email_confirmation_message.txt | 7 ++ .../email_confirmation_signup_message.txt | 1 + .../email_confirmation_signup_subject.txt | 1 + .../email/email_confirmation_subject.txt | 4 + .../email/password_reset_key_message.txt | 9 +++ .../email/password_reset_key_subject.txt | 4 + .../account/email/unknown_account_message.txt | 12 +++ .../account/email/unknown_account_subject.txt | 4 + templates/account/email_confirm.html | 32 ++++++++ templates/account/login.html | 56 +++++++++++++ templates/account/logout.html | 22 +++++ .../messages/cannot_delete_primary_email.txt | 2 + .../messages/email_confirmation_sent.txt | 2 + .../account/messages/email_confirmed.txt | 2 + templates/account/messages/email_deleted.txt | 2 + templates/account/messages/logged_in.txt | 4 + templates/account/messages/logged_out.txt | 2 + .../account/messages/password_changed.txt | 2 + templates/account/messages/password_set.txt | 2 + .../account/messages/primary_email_set.txt | 2 + .../messages/unverified_primary_email.txt | 2 + templates/account/password_change.html | 21 +++++ templates/account/password_reset.html | 29 +++++++ templates/account/password_reset_done.html | 17 ++++ .../account/password_reset_from_key.html | 24 ++++++ .../account/password_reset_from_key_done.html | 10 +++ templates/account/password_set.html | 21 +++++ templates/account/signup.html | 25 ++++++ templates/account/signup_closed.html | 12 +++ .../account/snippets/already_logged_in.html | 6 ++ templates/account/verification_sent.html | 15 ++++ .../account/verified_email_required.html | 24 ++++++ templates/partials/_navbar.html | 35 +++++--- 53 files changed, 829 insertions(+), 19 deletions(-) create mode 100644 fbf/README.md create mode 100644 fbf/templates/fbf/bird_create.html create mode 100644 rescuer/README.md create mode 100644 rescuer/templates/rescuer/rescuer_create.html create mode 100644 sites/templates/sites/index.html create mode 100644 sites/urls.py create mode 100644 templates/account/account_inactive.html create mode 100644 templates/account/base.html create mode 100644 templates/account/email.html create mode 100644 templates/account/email/base_message.txt create mode 100644 templates/account/email/email_confirmation_message.txt create mode 100644 templates/account/email/email_confirmation_signup_message.txt create mode 100644 templates/account/email/email_confirmation_signup_subject.txt create mode 100644 templates/account/email/email_confirmation_subject.txt create mode 100644 templates/account/email/password_reset_key_message.txt create mode 100644 templates/account/email/password_reset_key_subject.txt create mode 100644 templates/account/email/unknown_account_message.txt create mode 100644 templates/account/email/unknown_account_subject.txt create mode 100644 templates/account/email_confirm.html create mode 100644 templates/account/login.html create mode 100644 templates/account/logout.html create mode 100644 templates/account/messages/cannot_delete_primary_email.txt create mode 100644 templates/account/messages/email_confirmation_sent.txt create mode 100644 templates/account/messages/email_confirmed.txt create mode 100644 templates/account/messages/email_deleted.txt create mode 100644 templates/account/messages/logged_in.txt create mode 100644 templates/account/messages/logged_out.txt create mode 100644 templates/account/messages/password_changed.txt create mode 100644 templates/account/messages/password_set.txt create mode 100644 templates/account/messages/primary_email_set.txt create mode 100644 templates/account/messages/unverified_primary_email.txt create mode 100644 templates/account/password_change.html create mode 100644 templates/account/password_reset.html create mode 100644 templates/account/password_reset_done.html create mode 100644 templates/account/password_reset_from_key.html create mode 100644 templates/account/password_reset_from_key_done.html create mode 100644 templates/account/password_set.html create mode 100644 templates/account/signup.html create mode 100644 templates/account/signup_closed.html create mode 100644 templates/account/snippets/already_logged_in.html create mode 100644 templates/account/verification_sent.html create mode 100644 templates/account/verified_email_required.html diff --git a/core/settings.py b/core/settings.py index b8d383e..38ad548 100644 --- a/core/settings.py +++ b/core/settings.py @@ -39,6 +39,12 @@ INSTALLED_APPS = [ "django.contrib.messages", "django.contrib.staticfiles", # ----------------------------------- + # All auth + # ----------------------------------- + "allauth", + "allauth.account", + "allauth.socialaccount", + # ----------------------------------- # Crispy forms, modals and bootstrap5 # ----------------------------------- "bootstrap_modal_forms", @@ -80,6 +86,13 @@ TEMPLATES = [ }, ] +AUTHENTICATION_BACKENDS = [ + # Needed to login by username in Django admin, regardless of `allauth` + "django.contrib.auth.backends.ModelBackend", + # allauth specific authentication methods, such as login by e-mail + "allauth.account.auth_backends.AuthenticationBackend", +] + WSGI_APPLICATION = "core.wsgi.application" @@ -139,3 +152,19 @@ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField" # crispy forms CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" CRISPY_TEMPLATE_PACK = "bootstrap5" + +# allauth +SITE_ID = 1 +ACCOUNT_AUTHENTICATION_METHOD = "username_email" +ACCOUNT_EMAIL_REQUIRED = True +ACCOUNT_EMAIL_VERIFICATION = "mandatory" +ACCOUNT_LOGIN_ATTEMPTS_LIMIT = 5 +ACCOUNT_LOGIN_ATTEMPTS_TIMEOUT = 86400 # 1 day in seconds +ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True +ACCOUNT_LOGOUT_REDIRECT_URL = "/" +ACCOUNT_LOGOUT_ON_GET = True +ACCOUNT_SESSION_REMEMBER = True +ACCOUNT_USERNAME_BLACKLIST = ["gw", "admin", "god"] +ACCOUNT_USERNAME_MIN_LENGTH = 3 +ACCOUNT_UNIQUE_EMAIL = True +LOGIN_REDIRECT_URL = "/bird/all" diff --git a/core/urls.py b/core/urls.py index d70d753..71b3430 100644 --- a/core/urls.py +++ b/core/urls.py @@ -18,7 +18,13 @@ from django.contrib import admin from django.urls import path, include urlpatterns = [ + # Dynamic sites path("bird/", include("fbf.urls")), path("rescuer/", include("rescuer.urls")), + # Admin path("admin/", admin.site.urls), + # Allauth + path("accounts/", include("allauth.urls")), + # Static sites + path("", include("sites.urls")), ] diff --git a/fbf/README.md b/fbf/README.md new file mode 100644 index 0000000..7756990 --- /dev/null +++ b/fbf/README.md @@ -0,0 +1,6 @@ +# FBF App + +- create +- retrieve (all, single) +- update (all, single) +- delete (all, single) \ No newline at end of file diff --git a/fbf/templates/fbf/bird_all.html b/fbf/templates/fbf/bird_all.html index 489cd3b..52904fb 100644 --- a/fbf/templates/fbf/bird_all.html +++ b/fbf/templates/fbf/bird_all.html @@ -1,7 +1,15 @@ {% extends "base.html" %} {% load static %} {% block content %} -

Übersicht aller Vögel in Behandlung

+

Übersicht aller Patienten in Behandlung

+

+ Die Übersicht aller in Behandlung befindlichen Vögel umfasst nicht die entlassenen Patienten. +

+

+ +

@@ -26,4 +34,40 @@ {% endfor %}
+ + + + {% endblock content %} \ No newline at end of file diff --git a/fbf/templates/fbf/bird_create.html b/fbf/templates/fbf/bird_create.html new file mode 100644 index 0000000..e912c9f --- /dev/null +++ b/fbf/templates/fbf/bird_create.html @@ -0,0 +1,39 @@ +{% extends "base.html" %} +{% load static %} +{% load crispy_forms_tags %} +{% block content %} +

Patient anlegen

+

Legen Sie einen neuen Patienten an. Die mit * gekennzeichneten Felder sind Pflichfelder.

+
+
+
+
+ {% csrf_token %} + {{form|crispy}} + + + + + + +
+
+
+ {% endblock content %} \ No newline at end of file diff --git a/fbf/views.py b/fbf/views.py index 8d44163..dd389a8 100644 --- a/fbf/views.py +++ b/fbf/views.py @@ -1,22 +1,57 @@ -from django.shortcuts import render, HttpResponse, redirect -from .models import FallenBird +from django.contrib.auth.decorators import login_required +from django.shortcuts import HttpResponse, redirect, render + +from rescuer.models import Rescuer + from .forms import BirdForm +from .models import FallenBird +@login_required(login_url="account_login") def bird_create(request): - return HttpResponse("Create a bird") + # Rescuer for modal usage + # rescuer_modal = Rescuer.objects.all().filter(user=request.user) + form = BirdForm() + rescuer_id = request.session.get("rescuer_id") + # rescuer = Rescuer.objects.get(id=rescuer_id, user=request.user) + rescuer = Rescuer.objects.get(id=rescuer_id) + + # just show only related rescuers in select field of the form + if request.method == "POST": + form = BirdForm(request.POST or None, request.FILES or None) + if form.is_valid(): + fs = form.save(commit=False) + # fs.user = request.user + fs.rescuer_id = rescuer_id + fs.save() + request.session["rescuer_id"] = None + return redirect("bird_all") + context = {"form": form, "rescuer": rescuer} + return render(request, "fbf/bird_create.html") +@login_required(login_url="account_login") def bird_all(request): birds = FallenBird.objects.all() - context = {"birds": birds} + rescuer_modal = Rescuer.objects.all() + context = {"birds": birds, "rescuer_modal": rescuer_modal} + # Post came from the modal form + if request.method == "POST": + rescuer_id = request._post["rescuer_id"] + if rescuer_id != "new_rescuer": + request.session["rescuer_id"] = rescuer_id + return redirect("bird_create") + else: + return redirect("rescuer_create") return render(request, "fbf/bird_all.html", context) +@login_required(login_url="account_login") def bird_recover_all(request): return HttpResponse("Show all recovered Birds") +@login_required(login_url="account_login") def bird_single(request, id): bird = FallenBird.objects.get(id=id) form = BirdForm(request.POST or None, request.FILES or None, instance=bird) @@ -28,6 +63,7 @@ def bird_single(request, id): return render(request, "fbf/bird_single.html", context) +@login_required(login_url="account_login") def bird_delete(request, id): bird = FallenBird.objects.get(id=id) if request.method == "POST": @@ -37,5 +73,6 @@ def bird_delete(request, id): return render(request, "fbf/bird_delete.html", context) +@login_required(login_url="account_login") def bird_recover(request, id): return HttpResponse(f"Show recover with ID {id}") diff --git a/requirements.txt b/requirements.txt index 7fa879c..e4a3c39 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ Django>=4.2 +django-allauth>=0.50 django-bootstrap-datepicker-plus>=4.0 django-bootstrap-modal-forms>=2 django-crispy-forms>=1 diff --git a/rescuer/README.md b/rescuer/README.md new file mode 100644 index 0000000..d8bde1d --- /dev/null +++ b/rescuer/README.md @@ -0,0 +1,8 @@ +# Rescuer App + +- create +- retrieve (all, single) +- update (all, single) +- delete (all, single) + +If a rescuer is deleted, birds should not be delete or disappear! \ No newline at end of file diff --git a/rescuer/models.py b/rescuer/models.py index 8bad4e8..2b54c5f 100644 --- a/rescuer/models.py +++ b/rescuer/models.py @@ -1,5 +1,3 @@ -from django.db import models - from datetime import date from uuid import uuid4 diff --git a/rescuer/templates/rescuer/rescuer_create.html b/rescuer/templates/rescuer/rescuer_create.html new file mode 100644 index 0000000..1c4fb16 --- /dev/null +++ b/rescuer/templates/rescuer/rescuer_create.html @@ -0,0 +1,55 @@ +{% extends 'base.html' %} +{% load crispy_forms_tags %} +{% block content %} +

Retter anlegen

+
+
+
+ {% csrf_token %} +
+
{{ form.gender|as_crispy_field }}
+
{{ form.first_name|as_crispy_field }}
+
{{ form.last_name|as_crispy_field }}
+
{{ form.email|as_crispy_field }}
+
{{ form.date_of_birth|as_crispy_field }}
+
{{ form.street|as_crispy_field }}
+
{{ form.street_number|as_crispy_field }}
+
{{ form.city|as_crispy_field }}
+
{{ form.zip_code|as_crispy_field }}
+
{{ form.state|as_crispy_field }}
+
+ Abbruch + +
+
* Pflichtfeld
+
+ +
+
+

eins

+

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error nobis + necessitatibus distinctio pariatur vero sequi eum excepturi assumenda quam + maxime doloremque eligendi perspiciatis id aliquid, voluptate blanditiis + consequatur enim deleniti. +

+ +

zwei

+

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error nobis + necessitatibus distinctio pariatur vero sequi eum excepturi assumenda quam + maxime doloremque eligendi perspiciatis id aliquid, voluptate blanditiis + consequatur enim deleniti. +

+ +

drei

+

+ Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error nobis + necessitatibus distinctio pariatur vero sequi eum excepturi assumenda quam + maxime doloremque eligendi perspiciatis id aliquid, voluptate blanditiis + consequatur enim deleniti. +

+
+
+ +{% endblock content %} \ No newline at end of file diff --git a/rescuer/urls.py b/rescuer/urls.py index 397e15f..4c20300 100644 --- a/rescuer/urls.py +++ b/rescuer/urls.py @@ -1,8 +1,9 @@ from django.urls import path -from .views import rescuer_single, rescuer_all +from .views import rescuer_all, rescuer_create, rescuer_single urlpatterns = [ path("all", rescuer_all, name="rescuer_all"), path("", rescuer_single, name="rescuer_single"), + path("create", rescuer_create, name="rescuer_create"), ] diff --git a/rescuer/views.py b/rescuer/views.py index c4d757c..e53c822 100644 --- a/rescuer/views.py +++ b/rescuer/views.py @@ -1,4 +1,5 @@ from django.shortcuts import render + from .models import Rescuer @@ -12,3 +13,7 @@ def rescuer_single(request, id): rescuer = Rescuer.objects.get(id=id) context = {"rescuer": rescuer} return render(request, "rescuer/rescuer_single.html", context) + + +def rescuer_create(request): + return render(request, "rescuer/rescuuer_create.html") diff --git a/sites/templates/sites/index.html b/sites/templates/sites/index.html new file mode 100644 index 0000000..55a80b6 --- /dev/null +++ b/sites/templates/sites/index.html @@ -0,0 +1,20 @@ +{% extends 'base.html' %} {% block content %} +
+
+

Hello World

+

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Consectetur ea, + ut eum dolorum inventore perferendis repellat dicta accusamus commodi, + tempora perspiciatis incidunt odit. Minima exercitationem expedita, quae + doloribus repudiandae inventore? +

+
+
+
+

Lorem ipsum, dolor sit amet consectetur adipisicing elit. Voluptates ducimus inventore quia, quae quam + reiciendis eligendi explicabo non deleniti aliquid, modi dignissimos ullam ipsa incidunt vel similique fuga? + Suscipit, dolores?

+
+
+ +{% endblock content %} \ No newline at end of file diff --git a/sites/urls.py b/sites/urls.py new file mode 100644 index 0000000..657dd11 --- /dev/null +++ b/sites/urls.py @@ -0,0 +1,9 @@ +from .views import index, privacy, impress +from django.urls import path + + +urlpatterns = [ + path("", index, name="index"), + path("privacy/", privacy, name="privacy"), + path("impress/", impress, name="impress"), +] diff --git a/sites/views.py b/sites/views.py index 91ea44a..f7c6469 100644 --- a/sites/views.py +++ b/sites/views.py @@ -1,3 +1,13 @@ -from django.shortcuts import render +from django.shortcuts import redirect, render -# Create your views here. + +def index(request): + return render(request, "sites/index.html") + + +def privacy(request): + return render(request, "sites/privacy.html") + + +def impress(request): + return render(request, "sites/impress.html") diff --git a/static/css/style.css b/static/css/style.css index e69de29..b1d7129 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -0,0 +1,7 @@ +.rounded-pill { + margin-left: 5px; +} + +.footer { + font-size: small; +} \ No newline at end of file diff --git a/templates/account/account_inactive.html b/templates/account/account_inactive.html new file mode 100644 index 0000000..c6e7fbe --- /dev/null +++ b/templates/account/account_inactive.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} + +{% block head_title %}{% trans "Account Inactive" %}{% endblock %} + +{% block content %} +

{% trans "Account Inactive" %}

+ +

{% trans "This account is inactive." %}

+{% endblock %} diff --git a/templates/account/base.html b/templates/account/base.html new file mode 100644 index 0000000..4e12516 --- /dev/null +++ b/templates/account/base.html @@ -0,0 +1,40 @@ + + + + {% block head_title %}{% endblock %} + {% block extra_head %} + {% endblock %} + + + {% block body %} + + {% if messages %} +
+ Messages: +
    + {% for message in messages %} +
  • {{message}}
  • + {% endfor %} +
+
+ {% endif %} + +
+ Menu: + +
+ {% block content %} + {% endblock %} + {% endblock %} + {% block extra_body %} + {% endblock %} + + diff --git a/templates/account/email.html b/templates/account/email.html new file mode 100644 index 0000000..cd74314 --- /dev/null +++ b/templates/account/email.html @@ -0,0 +1,81 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} + +{% block head_title %}{% trans "E-mail Addresses" %}{% endblock %} + +{% block content %} +
+
+

{% trans "E-mail Addresses" %}

+ {% if user.emailaddress_set.all %} +

{% trans 'The following e-mail addresses are associated with your account:' %}

+ + + + {% else %} +

{% trans 'Warning:'%} {% 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." %}

+ + {% endif %} + {% if can_add_email %} +

{% trans "Add E-mail Address" %}

+ +
+ {% csrf_token %} + {{ form|crispy }} + + +
+ {% endif %} +
+
+{% endblock %} + + +{% block extra_body %} + +{% endblock %} \ No newline at end of file diff --git a/templates/account/email/base_message.txt b/templates/account/email/base_message.txt new file mode 100644 index 0000000..46f04f3 --- /dev/null +++ b/templates/account/email/base_message.txt @@ -0,0 +1,7 @@ +{% load i18n %}{% autoescape off %}{% blocktrans with site_name=current_site.name %}Hello from {{ site_name }}!{% endblocktrans %} + +{% block content %}{% endblock %} + +{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}Thank you for using {{ site_name }}! +{{ site_domain }}{% endblocktrans %} +{% endautoescape %} diff --git a/templates/account/email/email_confirmation_message.txt b/templates/account/email/email_confirmation_message.txt new file mode 100644 index 0000000..7f922d8 --- /dev/null +++ b/templates/account/email/email_confirmation_message.txt @@ -0,0 +1,7 @@ +{% extends "account/email/base_message.txt" %} +{% load account %} +{% load i18n %} + +{% block content %}{% autoescape off %}{% user_display user as user_display %}{% blocktrans with site_name=current_site.name site_domain=current_site.domain %}You're receiving this e-mail because user {{ user_display }} has given your e-mail address to register an account on {{ site_domain }}. + +To confirm this is correct, go to {{ activate_url }}{% endblocktrans %}{% endautoescape %}{% endblock %} diff --git a/templates/account/email/email_confirmation_signup_message.txt b/templates/account/email/email_confirmation_signup_message.txt new file mode 100644 index 0000000..9996f7e --- /dev/null +++ b/templates/account/email/email_confirmation_signup_message.txt @@ -0,0 +1 @@ +{% include "account/email/email_confirmation_message.txt" %} diff --git a/templates/account/email/email_confirmation_signup_subject.txt b/templates/account/email/email_confirmation_signup_subject.txt new file mode 100644 index 0000000..4c85ebb --- /dev/null +++ b/templates/account/email/email_confirmation_signup_subject.txt @@ -0,0 +1 @@ +{% include "account/email/email_confirmation_subject.txt" %} diff --git a/templates/account/email/email_confirmation_subject.txt b/templates/account/email/email_confirmation_subject.txt new file mode 100644 index 0000000..b0a876f --- /dev/null +++ b/templates/account/email/email_confirmation_subject.txt @@ -0,0 +1,4 @@ +{% load i18n %} +{% autoescape off %} +{% blocktrans %}Please Confirm Your E-mail Address{% endblocktrans %} +{% endautoescape %} diff --git a/templates/account/email/password_reset_key_message.txt b/templates/account/email/password_reset_key_message.txt new file mode 100644 index 0000000..5871c1e --- /dev/null +++ b/templates/account/email/password_reset_key_message.txt @@ -0,0 +1,9 @@ +{% extends "account/email/base_message.txt" %} +{% load i18n %} + +{% block content %}{% autoescape off %}{% blocktrans %}You're receiving this e-mail because you or someone else has requested a password for your user account. +It can be safely ignored if you did not request a password reset. Click the link below to reset your password.{% endblocktrans %} + +{{ password_reset_url }}{% if username %} + +{% blocktrans %}In case you forgot, your username is {{ username }}.{% endblocktrans %}{% endif %}{% endautoescape %}{% endblock %} diff --git a/templates/account/email/password_reset_key_subject.txt b/templates/account/email/password_reset_key_subject.txt new file mode 100644 index 0000000..6840c40 --- /dev/null +++ b/templates/account/email/password_reset_key_subject.txt @@ -0,0 +1,4 @@ +{% load i18n %} +{% autoescape off %} +{% blocktrans %}Password Reset E-mail{% endblocktrans %} +{% endautoescape %} diff --git a/templates/account/email/unknown_account_message.txt b/templates/account/email/unknown_account_message.txt new file mode 100644 index 0000000..e4e89d0 --- /dev/null +++ b/templates/account/email/unknown_account_message.txt @@ -0,0 +1,12 @@ +{% extends "account/email/base_message.txt" %} +{% load i18n %} + +{% block content %}{% autoescape off %}{% blocktrans %}You are receiving this e-mail because you or someone else has requested a +password for your user account. However, we do not have any record of a user +with email {{ email }} in our database. + +This mail can be safely ignored if you did not request a password reset. + +If it was you, you can sign up for an account using the link below.{% endblocktrans %} + +{{ signup_url }}{% endautoescape %}{% endblock %} diff --git a/templates/account/email/unknown_account_subject.txt b/templates/account/email/unknown_account_subject.txt new file mode 100644 index 0000000..6840c40 --- /dev/null +++ b/templates/account/email/unknown_account_subject.txt @@ -0,0 +1,4 @@ +{% load i18n %} +{% autoescape off %} +{% blocktrans %}Password Reset E-mail{% endblocktrans %} +{% endautoescape %} diff --git a/templates/account/email_confirm.html b/templates/account/email_confirm.html new file mode 100644 index 0000000..6ef18a8 --- /dev/null +++ b/templates/account/email_confirm.html @@ -0,0 +1,32 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} +{% load account %} + +{% block head_title %}{% trans "Confirm E-mail Address" %}{% endblock %} + + +{% block content %} +

{% trans "Confirm E-mail Address" %}

+ +{% if confirmation %} + +{% user_display confirmation.email_address.user as user_display %} + +

{% blocktrans with confirmation.email_address.email as email %}Please confirm that {{ email }} is an e-mail address for user {{ user_display }}.{% endblocktrans %}

+ +
+{% csrf_token %} + +
+ +{% else %} + +{% url 'account_email' as email_url %} + +

{% blocktrans %}This e-mail confirmation link expired or is invalid. Please issue a new e-mail confirmation request.{% endblocktrans %}

+ +{% endif %} + +{% endblock %} diff --git a/templates/account/login.html b/templates/account/login.html new file mode 100644 index 0000000..34a8709 --- /dev/null +++ b/templates/account/login.html @@ -0,0 +1,56 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} + +{% load account socialaccount %} + +{% block head_title %}{% trans "Sign In" %}{% endblock %} + +{% block content %} +
+
+ +

{% trans "Sign In" %}

+ +{% get_providers as socialaccount_providers %} + +{% if socialaccount_providers %} +

{% blocktrans with site.name as site_name %}Please sign in with one +of your existing third party accounts. Or, sign up +for a {{ site_name }} account and sign in below:{% endblocktrans %}

+ +
+
    + {% include "socialaccount/snippets/provider_list.html" with process="login" %} +
+ +
+ +{% include "socialaccount/snippets/login_extra.html" %} + +{% else %} +

{% blocktrans %}If you have not created an account yet, then please +sign up first.{% endblocktrans %}

+{% endif %} + + +
+ +{% comment %} +
+

Login

+

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fuga sapiente rerum dignissimos voluptatum, expedita saepe quae voluptas possimus eveniet eligendi fugiat similique repudiandae. Necessitatibus fugiat accusamus laudantium qui, et dolore?

+
+{% endcomment %} +
+ +{% endblock %} diff --git a/templates/account/logout.html b/templates/account/logout.html new file mode 100644 index 0000000..618b574 --- /dev/null +++ b/templates/account/logout.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} + +{% block head_title %}{% trans "Sign Out" %}{% endblock %} + +{% block content %} +

{% trans "Sign Out" %}

+ +

{% trans 'Are you sure you want to sign out?' %}

+ +
+ {% csrf_token %} + {% if redirect_field_value %} + + {% endif %} + +
+ + +{% endblock %} diff --git a/templates/account/messages/cannot_delete_primary_email.txt b/templates/account/messages/cannot_delete_primary_email.txt new file mode 100644 index 0000000..de55571 --- /dev/null +++ b/templates/account/messages/cannot_delete_primary_email.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}You cannot remove your primary e-mail address ({{email}}).{% endblocktrans %} diff --git a/templates/account/messages/email_confirmation_sent.txt b/templates/account/messages/email_confirmation_sent.txt new file mode 100644 index 0000000..7a526f8 --- /dev/null +++ b/templates/account/messages/email_confirmation_sent.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Confirmation e-mail sent to {{email}}.{% endblocktrans %} diff --git a/templates/account/messages/email_confirmed.txt b/templates/account/messages/email_confirmed.txt new file mode 100644 index 0000000..3427a4d --- /dev/null +++ b/templates/account/messages/email_confirmed.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}You have confirmed {{email}}.{% endblocktrans %} diff --git a/templates/account/messages/email_deleted.txt b/templates/account/messages/email_deleted.txt new file mode 100644 index 0000000..5cf7cf9 --- /dev/null +++ b/templates/account/messages/email_deleted.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Removed e-mail address {{email}}.{% endblocktrans %} diff --git a/templates/account/messages/logged_in.txt b/templates/account/messages/logged_in.txt new file mode 100644 index 0000000..f49248a --- /dev/null +++ b/templates/account/messages/logged_in.txt @@ -0,0 +1,4 @@ +{% load account %} +{% load i18n %} +{% user_display user as name %} +{% blocktrans %}Successfully signed in as {{name}}.{% endblocktrans %} diff --git a/templates/account/messages/logged_out.txt b/templates/account/messages/logged_out.txt new file mode 100644 index 0000000..2cd4627 --- /dev/null +++ b/templates/account/messages/logged_out.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}You have signed out.{% endblocktrans %} diff --git a/templates/account/messages/password_changed.txt b/templates/account/messages/password_changed.txt new file mode 100644 index 0000000..bd5801c --- /dev/null +++ b/templates/account/messages/password_changed.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Password successfully changed.{% endblocktrans %} diff --git a/templates/account/messages/password_set.txt b/templates/account/messages/password_set.txt new file mode 100644 index 0000000..9d224ee --- /dev/null +++ b/templates/account/messages/password_set.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Password successfully set.{% endblocktrans %} diff --git a/templates/account/messages/primary_email_set.txt b/templates/account/messages/primary_email_set.txt new file mode 100644 index 0000000..b6a70dd --- /dev/null +++ b/templates/account/messages/primary_email_set.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Primary e-mail address set.{% endblocktrans %} diff --git a/templates/account/messages/unverified_primary_email.txt b/templates/account/messages/unverified_primary_email.txt new file mode 100644 index 0000000..9c9d0d8 --- /dev/null +++ b/templates/account/messages/unverified_primary_email.txt @@ -0,0 +1,2 @@ +{% load i18n %} +{% blocktrans %}Your primary e-mail address must be verified.{% endblocktrans %} diff --git a/templates/account/password_change.html b/templates/account/password_change.html new file mode 100644 index 0000000..ffe59ae --- /dev/null +++ b/templates/account/password_change.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} + +{% block head_title %}{% trans "Change Password" %}{% endblock %} + +{% block content %} +
+
+

{% trans "Change Password" %}

+ +
+ {% csrf_token %} + {{ form|crispy }} + + {% trans "Forgot Password?" %} +
+
+
+{% endblock %} diff --git a/templates/account/password_reset.html b/templates/account/password_reset.html new file mode 100644 index 0000000..32be147 --- /dev/null +++ b/templates/account/password_reset.html @@ -0,0 +1,29 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} +{% load account %} + +{% block head_title %}{% trans "Password Reset" %}{% endblock %} + +{% block content %} +
+
+ +

{% trans "Password Reset" %}

+ {% if user.is_authenticated %} + {% include "account/snippets/already_logged_in.html" %} + {% endif %} + +

{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}

+ +
+ {% csrf_token %} + {{ form|crispy }} + +
+
+

{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}

+
+
+{% endblock %} diff --git a/templates/account/password_reset_done.html b/templates/account/password_reset_done.html new file mode 100644 index 0000000..4b0aad6 --- /dev/null +++ b/templates/account/password_reset_done.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} +{% load account %} + +{% block head_title %}{% trans "Password Reset" %}{% endblock %} + +{% block content %} +

{% trans "Password Reset" %}

+ + {% if user.is_authenticated %} + {% include "account/snippets/already_logged_in.html" %} + {% endif %} + +

{% blocktrans %}We have sent you an e-mail. If you have not received it please check your spam folder. Otherwise contact us if you do not receive it in a few minutes.{% endblocktrans %}

+{% endblock %} diff --git a/templates/account/password_reset_from_key.html b/templates/account/password_reset_from_key.html new file mode 100644 index 0000000..96d68e7 --- /dev/null +++ b/templates/account/password_reset_from_key.html @@ -0,0 +1,24 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} +{% block head_title %}{% trans "Change Password" %}{% endblock %} + +{% block content %} +
+
+

{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}

+ + {% if token_fail %} + {% url 'account_reset_password' as passwd_reset_url %} +

{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a new password reset.{% endblocktrans %}

+ {% else %} +
+ {% csrf_token %} + {{ form|crispy }} + +
+ {% endif %} +
+
+{% endblock %} diff --git a/templates/account/password_reset_from_key_done.html b/templates/account/password_reset_from_key_done.html new file mode 100644 index 0000000..69fdfcb --- /dev/null +++ b/templates/account/password_reset_from_key_done.html @@ -0,0 +1,10 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} +{% block head_title %}{% trans "Change Password" %}{% endblock %} + +{% block content %} +

{% trans "Change Password" %}

+

{% trans 'Your password is now changed.' %}

+{% endblock %} diff --git a/templates/account/password_set.html b/templates/account/password_set.html new file mode 100644 index 0000000..0a5199c --- /dev/null +++ b/templates/account/password_set.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} + +{% block head_title %}{% trans "Set Password" %}{% endblock %} + +{% block content %} +
+
+ +

{% trans "Set Password" %}

+ +
+ {% csrf_token %} + {{ form|crispy }} + +
+
+
+{% endblock %} diff --git a/templates/account/signup.html b/templates/account/signup.html new file mode 100644 index 0000000..99ab92c --- /dev/null +++ b/templates/account/signup.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} + +{% block head_title %}{% trans "Signup" %}{% endblock %} + +{% block content %} +
+
+

{% trans "Sign Up" %}

+ +

{% blocktrans %}Already have an account? Then please sign in.{% endblocktrans %}

+ + +
+
+{% endblock %} diff --git a/templates/account/signup_closed.html b/templates/account/signup_closed.html new file mode 100644 index 0000000..309fbcb --- /dev/null +++ b/templates/account/signup_closed.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} + +{% block head_title %}{% trans "Sign Up Closed" %}{% endblock %} + +{% block content %} +

{% trans "Sign Up Closed" %}

+ +

{% trans "We are sorry, but the sign up is currently closed." %}

+{% endblock %} diff --git a/templates/account/snippets/already_logged_in.html b/templates/account/snippets/already_logged_in.html new file mode 100644 index 0000000..a53d47b --- /dev/null +++ b/templates/account/snippets/already_logged_in.html @@ -0,0 +1,6 @@ +{% load i18n %} +{% load crispy_forms_tags %} +{% load account %} + +{% user_display user as user_display %} +

{% trans "Note" %}: {% blocktrans %}you are already logged in as {{ user_display }}.{% endblocktrans %}

diff --git a/templates/account/verification_sent.html b/templates/account/verification_sent.html new file mode 100644 index 0000000..315878a --- /dev/null +++ b/templates/account/verification_sent.html @@ -0,0 +1,15 @@ +{% extends "base.html" %} + +{% load i18n %} + +{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} + +{% block content %} +
+
+

{% trans "Verify Your E-mail Address" %}

+

{% blocktrans %}We have sent an e-mail to you for verification. Follow the link provided to finalize the signup process. If you do not see the verification e-mail in your main inbox, check your spam folder. Please contact us if you do not receive the verification e-mail within a few minutes.{% endblocktrans %}

+
+
+ +{% endblock %} diff --git a/templates/account/verified_email_required.html b/templates/account/verified_email_required.html new file mode 100644 index 0000000..3739c85 --- /dev/null +++ b/templates/account/verified_email_required.html @@ -0,0 +1,24 @@ +{% extends "base.html" %} + +{% load i18n %} +{% load crispy_forms_tags %} + +{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %} + +{% block content %} +

{% trans "Verify Your E-mail Address" %}

+ +{% url 'account_email' as email_url %} + +

{% blocktrans %}This part of the site requires us to verify that +you are who you claim to be. For this purpose, we require that you +verify ownership of your e-mail address. {% endblocktrans %}

+ +

{% blocktrans %}We have sent an e-mail to you for +verification. Please click on the link inside that e-mail. If you do not see the verification e-mail in your main inbox, check your spam folder. Otherwise +contact us if you do not receive it within a few minutes.{% endblocktrans %}

+ +

{% blocktrans %}Note: you can still change your e-mail address.{% endblocktrans %}

+ + +{% endblock %} diff --git a/templates/partials/_navbar.html b/templates/partials/_navbar.html index dd9633c..99aad1c 100644 --- a/templates/partials/_navbar.html +++ b/templates/partials/_navbar.html @@ -1,25 +1,42 @@ {% load static %}