accounts, add modal and many more

This commit is contained in:
gw3000 2023-06-11 13:52:42 +02:00
parent 7a4cb2ff67
commit 81dba3e6b3
53 changed files with 829 additions and 19 deletions

View file

@ -39,6 +39,12 @@ INSTALLED_APPS = [
"django.contrib.messages", "django.contrib.messages",
"django.contrib.staticfiles", "django.contrib.staticfiles",
# ----------------------------------- # -----------------------------------
# All auth
# -----------------------------------
"allauth",
"allauth.account",
"allauth.socialaccount",
# -----------------------------------
# Crispy forms, modals and bootstrap5 # Crispy forms, modals and bootstrap5
# ----------------------------------- # -----------------------------------
"bootstrap_modal_forms", "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" WSGI_APPLICATION = "core.wsgi.application"
@ -139,3 +152,19 @@ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
# crispy forms # crispy forms
CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
CRISPY_TEMPLATE_PACK = "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"

View file

@ -18,7 +18,13 @@ from django.contrib import admin
from django.urls import path, include from django.urls import path, include
urlpatterns = [ urlpatterns = [
# Dynamic sites
path("bird/", include("fbf.urls")), path("bird/", include("fbf.urls")),
path("rescuer/", include("rescuer.urls")), path("rescuer/", include("rescuer.urls")),
# Admin
path("admin/", admin.site.urls), path("admin/", admin.site.urls),
# Allauth
path("accounts/", include("allauth.urls")),
# Static sites
path("", include("sites.urls")),
] ]

6
fbf/README.md Normal file
View file

@ -0,0 +1,6 @@
# FBF App
- create
- retrieve (all, single)
- update (all, single)
- delete (all, single)

View file

@ -1,7 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %} {% load static %}
{% block content %} {% block content %}
<h3>Übersicht aller Vögel in Behandlung</h3> <h3>Übersicht aller Patienten in Behandlung</h3>
<p>
Die Übersicht aller in Behandlung befindlichen Vögel umfasst <strong>nicht</strong> die entlassenen Patienten.
</p>
<p>
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#addPatientModal">einen Patienten
anlegen
</button>
</p>
<table class="table table-striped table-hover" id="t__bids_all"> <table class="table table-striped table-hover" id="t__bids_all">
<thead> <thead>
<tr> <tr>
@ -26,4 +34,40 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<div class="modal fade" id="addPatientModal" tabindex="-1" data-bs-backdrop="static"
aria-labelledby="addRescuerModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-primary">
<h5 class="modal-title text-white" id="addRescuerModalLabel">(neuen) Retter zuweisen</h5>
</div>
<form method="post">
{% csrf_token %}
<div class="modal-body">
<label for="rescuer" class="form-label mt-3">Wählen Sie einen <strong>bereits angelegten</strong>
Retter aus oder legen Sie einen <strong>neuen</strong> Retter an:</label>
<select id="rescuer" class="form-select" name="rescuer_id">
{% for rescuer in rescuer_modal %}
<option value={{rescuer.id}}>
{{rescuer.first_name}} {{rescuer.last_name}},
{{rescuer.street}} {{rescuer.street_number}},
{{rescuer.city}}
</option>
{% endfor %}
<option value="new_rescuer"><strong>neuen
Retter anlegen</strong></option>
</select>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-bs-dismiss="modal">Abbruch</button>
<button class="btn btn-primary" type="submit">Übernehmen und
weiter</button>
</div>
</div>
</div>
</div>
</form>
{% endblock content %} {% endblock content %}

View file

@ -0,0 +1,39 @@
{% extends "base.html" %}
{% load static %}
{% load crispy_forms_tags %}
{% block content %}
<h3>Patient anlegen</h3>
<p>Legen Sie einen neuen Patienten an. Die mit <strong>*</strong> gekennzeichneten Felder sind Pflichfelder.</p>
<div class="row">
<div class="col-lg-6 mb-3">
<form method="post" enctype="multipart/form-data">
<fieldset>
{% csrf_token %}
{{form|crispy}}
<button class="btn btn-success" type="abbort">Abbrechen</button>
<button class="btn btn-danger" type="reset">Felder Rücksetzen</button>
<button class="btn btn-primary" type="submit">Speichern und zur Übersicht</button>
<div class="modal fade" id="exampleModal" tabindex="-1" data-bs-backdrop="static"
aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header bg-danger">
<h5 class="modal-title text-white" id="exampleModalLabel">Achtung unvollständiger
Vertrag!</h5>
</div>
<div class="modal-body">
Der Versicherungsnehmer wird bei Abbruch gelöscht, da ihm
bisher kein Vertrag zugeordnet wurde.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
</fieldset>
</form>
</div>
{% endblock content %}

View file

@ -1,22 +1,57 @@
from django.shortcuts import render, HttpResponse, redirect from django.contrib.auth.decorators import login_required
from .models import FallenBird from django.shortcuts import HttpResponse, redirect, render
from rescuer.models import Rescuer
from .forms import BirdForm from .forms import BirdForm
from .models import FallenBird
@login_required(login_url="account_login")
def bird_create(request): 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): def bird_all(request):
birds = FallenBird.objects.all() 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) return render(request, "fbf/bird_all.html", context)
@login_required(login_url="account_login")
def bird_recover_all(request): def bird_recover_all(request):
return HttpResponse("Show all recovered Birds") return HttpResponse("Show all recovered Birds")
@login_required(login_url="account_login")
def bird_single(request, id): def bird_single(request, id):
bird = FallenBird.objects.get(id=id) bird = FallenBird.objects.get(id=id)
form = BirdForm(request.POST or None, request.FILES or None, instance=bird) 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) return render(request, "fbf/bird_single.html", context)
@login_required(login_url="account_login")
def bird_delete(request, id): def bird_delete(request, id):
bird = FallenBird.objects.get(id=id) bird = FallenBird.objects.get(id=id)
if request.method == "POST": if request.method == "POST":
@ -37,5 +73,6 @@ def bird_delete(request, id):
return render(request, "fbf/bird_delete.html", context) return render(request, "fbf/bird_delete.html", context)
@login_required(login_url="account_login")
def bird_recover(request, id): def bird_recover(request, id):
return HttpResponse(f"Show recover with ID {id}") return HttpResponse(f"Show recover with ID {id}")

View file

@ -1,4 +1,5 @@
Django>=4.2 Django>=4.2
django-allauth>=0.50
django-bootstrap-datepicker-plus>=4.0 django-bootstrap-datepicker-plus>=4.0
django-bootstrap-modal-forms>=2 django-bootstrap-modal-forms>=2
django-crispy-forms>=1 django-crispy-forms>=1

8
rescuer/README.md Normal file
View file

@ -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!

View file

@ -1,5 +1,3 @@
from django.db import models
from datetime import date from datetime import date
from uuid import uuid4 from uuid import uuid4

View file

@ -0,0 +1,55 @@
{% extends 'base.html' %}
{% load crispy_forms_tags %}
{% block content %}
<h4>Retter anlegen</h4>
<div class="row">
<div class="col-lg-6">
<form method="post" class="form-horizontal">
{% csrf_token %}
<div class="row">
<div class="col-md-12 col-lg-12">{{ form.gender|as_crispy_field }}</div>
<div class="col-md-12 col-lg-6">{{ form.first_name|as_crispy_field }}</div>
<div class="col-md-12 col-lg-6">{{ form.last_name|as_crispy_field }}</div>
<div class="col-md-12 col-lg-8">{{ form.email|as_crispy_field }}</div>
<div class="col-md-12 col-lg-4">{{ form.date_of_birth|as_crispy_field }}</div>
<div class="col-md-12 col-lg-8">{{ form.street|as_crispy_field }}</div>
<div class="col-md-12 col-lg-4">{{ form.street_number|as_crispy_field }}</div>
<div class="col-md-12 col-lg-8">{{ form.city|as_crispy_field }}</div>
<div class="col-md-12 col-lg-4">{{ form.zip_code|as_crispy_field }}</div>
<div class="col-md-12 col-lg-12">{{ form.state|as_crispy_field }}</div>
</div>
<a href="{% url 'bird_all' %}" class="btn btn-danger">Abbruch</a>
<button class="btn btn-primary" type="submit">Speichern</button>
</form>
<div class="mt-3"><small>* Pflichtfeld</small></div>
</div>
<div class="col-lg-4">
<br />
<h4>eins</h4>
<p>
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.
</p>
<h4>zwei</h4>
<p>
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.
</p>
<h4>drei</h4>
<p>
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.
</p>
</div>
</div>
{% endblock content %}

View file

@ -1,8 +1,9 @@
from django.urls import path from django.urls import path
from .views import rescuer_single, rescuer_all from .views import rescuer_all, rescuer_create, rescuer_single
urlpatterns = [ urlpatterns = [
path("all", rescuer_all, name="rescuer_all"), path("all", rescuer_all, name="rescuer_all"),
path("<id>", rescuer_single, name="rescuer_single"), path("<id>", rescuer_single, name="rescuer_single"),
path("create", rescuer_create, name="rescuer_create"),
] ]

View file

@ -1,4 +1,5 @@
from django.shortcuts import render from django.shortcuts import render
from .models import Rescuer from .models import Rescuer
@ -12,3 +13,7 @@ def rescuer_single(request, id):
rescuer = Rescuer.objects.get(id=id) rescuer = Rescuer.objects.get(id=id)
context = {"rescuer": rescuer} context = {"rescuer": rescuer}
return render(request, "rescuer/rescuer_single.html", context) return render(request, "rescuer/rescuer_single.html", context)
def rescuer_create(request):
return render(request, "rescuer/rescuuer_create.html")

View file

@ -0,0 +1,20 @@
{% extends 'base.html' %} {% block content %}
<div class="row">
<div class="col-lg-7">
<h1>Hello World</h1>
<p>
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?
</p>
</div>
<div class="col-lg-5">
<br>
<p>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?</p>
</div>
</div>
{% endblock content %}

9
sites/urls.py Normal file
View file

@ -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"),
]

View file

@ -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")

View file

@ -0,0 +1,7 @@
.rounded-pill {
margin-left: 5px;
}
.footer {
font-size: small;
}

View file

@ -0,0 +1,12 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Account Inactive" %}{% endblock %}
{% block content %}
<h1>{% trans "Account Inactive" %}</h1>
<p>{% trans "This account is inactive." %}</p>
{% endblock %}

View file

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<title>{% block head_title %}{% endblock %}</title>
{% block extra_head %}
{% endblock %}
</head>
<body>
{% block body %}
{% if messages %}
<div>
<strong>Messages:</strong>
<ul>
{% for message in messages %}
<li>{{message}}</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div>
<strong>Menu:</strong>
<ul>
{% if user.is_authenticated %}
<li><a href="{% url 'account_email' %}">Change E-mail</a></li>
<li><a href="{% url 'account_logout' %}">Sign Out</a></li>
{% else %}
<li><a href="{% url 'account_login' %}">Sign In</a></li>
<li><a href="{% url 'account_signup' %}">Sign Up</a></li>
{% endif %}
</ul>
</div>
{% block content %}
{% endblock %}
{% endblock %}
{% block extra_body %}
{% endblock %}
</body>
</html>

View file

@ -0,0 +1,81 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "E-mail Addresses" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-7">
<h1>{% trans "E-mail Addresses" %}</h1>
{% if user.emailaddress_set.all %}
<p>{% trans '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">
{% for emailaddress in user.emailaddress_set.all %}
<div class="ctrlHolder">
<label for="email_radio_{{forloop.counter}}" class="{% if emailaddress.primary %}primary_email{%endif%}">
<input id="email_radio_{{forloop.counter}}" type="radio" name="email" {% if emailaddress.primary or
user.emailaddress_set.count==1 %}checked="checked" {%endif %} value="{{emailaddress.email}}" />
{{ emailaddress.email }}
{% if emailaddress.verified %}
<span class="verified">{% trans "Verified" %}</span>
{% else %}
<span class="unverified">{% trans "Unverified" %}</span>
{% endif %}
{% if emailaddress.primary %}<span class="primary">{% trans "Primary" %}</span>{% endif %}
</label>
</div>
{% endfor %}
<div class="buttonHolder">
<button class="btn btn-primary secondaryAction" type="submit" name="action_primary">{% trans 'Make Primary'
%}</button>
<button class="btn btn-success secondaryAction" type="submit" name="action_send">{% trans 'Re-send
Verification' %}</button>
<button class="btn btn-danger primaryAction" type="submit" name="action_remove">{% trans 'Remove' %}</button>
</div>
</fieldset>
</form>
{% 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 %}
{% if can_add_email %}
<h2>{% trans "Add E-mail Address" %}</h2>
<form method="post" action="{% url 'account_email' %}" class="add_email">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-primary" name="action_add" type="submit">{% trans "Add E-mail" %}</button>
</form>
{% endif %}
</div>
</div>
{% endblock %}
{% block extra_body %}
<script type="text/javascript">
(function () {
var message = "{% trans '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) {
if (!confirm(message)) {
e.preventDefault();
}
});
}
})();
</script>
{% endblock %}

View file

@ -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 %}

View file

@ -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 %}

View file

@ -0,0 +1 @@
{% include "account/email/email_confirmation_message.txt" %}

View file

@ -0,0 +1 @@
{% include "account/email/email_confirmation_subject.txt" %}

View file

@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Please Confirm Your E-mail Address{% endblocktrans %}
{% endautoescape %}

View file

@ -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 %}

View file

@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Password Reset E-mail{% endblocktrans %}
{% endautoescape %}

View file

@ -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 %}

View file

@ -0,0 +1,4 @@
{% load i18n %}
{% autoescape off %}
{% blocktrans %}Password Reset E-mail{% endblocktrans %}
{% endautoescape %}

View file

@ -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 %}
<h1>{% trans "Confirm E-mail Address" %}</h1>
{% if confirmation %}
{% user_display confirmation.email_address.user as user_display %}
<p>{% blocktrans with confirmation.email_address.email as email %}Please confirm that <a href="mailto:{{ email }}">{{ email }}</a> is an e-mail address for user {{ user_display }}.{% endblocktrans %}</p>
<form method="post" action="{% url 'account_confirm_email' confirmation.key %}">
{% csrf_token %}
<button class="btn btn-primary" type="submit">{% trans 'Confirm' %}</button>
</form>
{% else %}
{% url 'account_email' as email_url %}
<p>{% blocktrans %}This e-mail confirmation link expired or is invalid. Please <a href="{{ email_url }}">issue a new e-mail confirmation request</a>.{% endblocktrans %}</p>
{% endif %}
{% endblock %}

View file

@ -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 %}
<div class="row">
<div class="col-lg-5">
<h1>{% trans "Sign In" %}</h1>
{% get_providers as socialaccount_providers %}
{% if socialaccount_providers %}
<p>{% blocktrans with site.name as site_name %}Please sign in with one
of your existing third party accounts. Or, <a href="{{ signup_url }}">sign up</a>
for a {{ site_name }} account and sign in below:{% endblocktrans %}</p>
<div class="socialaccount_ballot">
<ul class="socialaccount_providers">
{% include "socialaccount/snippets/provider_list.html" with process="login" %}
</ul>
<div class="login-or">{% trans 'or' %}</div>
</div>
{% include "socialaccount/snippets/login_extra.html" %}
{% else %}
<p>{% blocktrans %}If you have not created an account yet, then please
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
{% endif %}
<form class="login" method="POST" action="{% url 'account_login' %}">
{% csrf_token %}
{{ form|crispy }}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<a class="btn btn-danger" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
<button class="btn btn-primary" type="submit">{% trans "Sign In" %}</button>
</form>
</div>
{% comment %}
<div class="col-lg-5">
<h4>Login</h4>
<p>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?</p>
</div>
{% endcomment %}
</div>
{% endblock %}

View file

@ -0,0 +1,22 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Sign Out" %}{% endblock %}
{% block content %}
<h1>{% trans "Sign Out" %}</h1>
<p>{% trans 'Are you sure you want to sign out?' %}</p>
<form method="post" action="{% url 'account_logout' %}">
{% csrf_token %}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}"/>
{% endif %}
<button type="submit">{% trans 'Sign Out' %}</button>
</form>
{% endblock %}

View file

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}You cannot remove your primary e-mail address ({{email}}).{% endblocktrans %}

View file

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Confirmation e-mail sent to {{email}}.{% endblocktrans %}

View file

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}You have confirmed {{email}}.{% endblocktrans %}

View file

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Removed e-mail address {{email}}.{% endblocktrans %}

View file

@ -0,0 +1,4 @@
{% load account %}
{% load i18n %}
{% user_display user as name %}
{% blocktrans %}Successfully signed in as {{name}}.{% endblocktrans %}

View file

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}You have signed out.{% endblocktrans %}

View file

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Password successfully changed.{% endblocktrans %}

View file

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Password successfully set.{% endblocktrans %}

View file

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Primary e-mail address set.{% endblocktrans %}

View file

@ -0,0 +1,2 @@
{% load i18n %}
{% blocktrans %}Your primary e-mail address must be verified.{% endblocktrans %}

View file

@ -0,0 +1,21 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Change Password" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-7">
<h1>{% trans "Change Password" %}</h1>
<form method="POST" action="{% url 'account_change_password' %}" class="password_change">
{% csrf_token %}
{{ form|crispy }}
<button class="btn btn-primary" type="submit" name="action">{% trans "Change Password" %}</button>
<a href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
</form>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,29 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load account %}
{% block head_title %}{% trans "Password Reset" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-7">
<h1>{% trans "Password Reset" %}</h1>
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %}
{% endif %}
<p>{% trans "Forgotten your password? Enter your e-mail address below, and we'll send you an e-mail allowing you to reset it." %}</p>
<form method="POST" action="{% url 'account_reset_password' %}" class="password_reset">
{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary" type="submit" value="{% trans 'Reset My Password' %}" />
</form>
<br>
<p>{% blocktrans %}Please contact us if you have any trouble resetting your password.{% endblocktrans %}</p>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,17 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% load account %}
{% block head_title %}{% trans "Password Reset" %}{% endblock %}
{% block content %}
<h1>{% trans "Password Reset" %}</h1>
{% if user.is_authenticated %}
{% include "account/snippets/already_logged_in.html" %}
{% endif %}
<p>{% 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 %}</p>
{% endblock %}

View file

@ -0,0 +1,24 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Change Password" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-7">
<h1>{% if token_fail %}{% trans "Bad Token" %}{% else %}{% trans "Change Password" %}{% endif %}</h1>
{% if token_fail %}
{% url 'account_reset_password' as passwd_reset_url %}
<p>{% blocktrans %}The password reset link was invalid, possibly because it has already been used. Please request a <a href="{{ passwd_reset_url }}">new password reset</a>.{% endblocktrans %}</p>
{% else %}
<form method="POST" action="{{ action_url }}">
{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary" type="submit" name="action" value="{% trans 'change password' %}"/>
</form>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,10 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Change Password" %}{% endblock %}
{% block content %}
<h1>{% trans "Change Password" %}</h1>
<p>{% trans 'Your password is now changed.' %}</p>
{% endblock %}

View file

@ -0,0 +1,21 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Set Password" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-7">
<h1>{% trans "Set Password" %}</h1>
<form method="POST" action="{% url 'account_set_password' %}" class="password_set">
{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary" type="submit" name="action" value="{% trans 'Set Password' %}"/>
</form>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,25 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Signup" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-5">
<h1>{% trans "Sign Up" %}</h1>
<p>{% blocktrans %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktrans %}</p>
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
{% csrf_token %}
{{ form|crispy }}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<button class="btn btn-primary" type="submit">{% trans "Sign Up" %} &raquo;</button>
</form>
</div>
</div>
{% endblock %}

View file

@ -0,0 +1,12 @@
{% extends "base.html" %}
{% load i18n %}
{% load crispy_forms_tags %}
{% block head_title %}{% trans "Sign Up Closed" %}{% endblock %}
{% block content %}
<h1>{% trans "Sign Up Closed" %}</h1>
<p>{% trans "We are sorry, but the sign up is currently closed." %}</p>
{% endblock %}

View file

@ -0,0 +1,6 @@
{% load i18n %}
{% load crispy_forms_tags %}
{% load account %}
{% user_display user as user_display %}
<p><strong>{% trans "Note" %}:</strong> {% blocktrans %}you are already logged in as {{ user_display }}.{% endblocktrans %}</p>

View file

@ -0,0 +1,15 @@
{% extends "base.html" %}
{% load i18n %}
{% block head_title %}{% trans "Verify Your E-mail Address" %}{% endblock %}
{% block content %}
<div class="row">
<div class="col-lg-7">
<h1>{% trans "Verify Your E-mail Address" %}</h1>
<p>{% 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 %}</p>
</div>
</div>
{% endblock %}

View file

@ -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 %}
<h1>{% trans "Verify Your E-mail Address" %}</h1>
{% url 'account_email' as email_url %}
<p>{% 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 %}</p>
<p>{% 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 %}</p>
<p>{% blocktrans %}<strong>Note:</strong> you can still <a href="{{ email_url }}">change your e-mail address</a>.{% endblocktrans %}</p>
{% endblock %}

View file

@ -1,25 +1,42 @@
{% load static %} {% load static %}
<nav class="navbar navbar-expand-lg navbar-dark bg-primary sticky-top"> <nav class="navbar navbar-expand-lg navbar-dark bg-primary sticky-top">
<div class="container"> <div class="container">
<a class="navbar-brand" href="{% url 'index' %}">
<img src="{% static 'img/logo.png' %}" alt="logo" width="35" height="35" /> <img src="{% static 'img/logo.png' %}" alt="logo" width="35" height="35" />
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor01" <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarColor01"
aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation"> aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
<div class="collapse navbar-collapse" id="navbarColor01">
<div class="collapse navbar-collapse"> <ul class="navbar-nav me-auto">
<ul class="navbar-nav"> {% if user.is_authenticated %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link {% if '/bird/all' in request.path %} active {% endif %}" <a class="nav-link {% if '/bird/all/' in request.path %} active {% endif %}"
href="{% url 'bird_all' %}">Vögel in Behandlung</a> href="{% url 'bird_all' %}">alle Patienten</a>
</li> </li>
</ul>
<ul class="navbar-nav">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link {% if '/rescuer/all' in request.path %} active {% endif %}" <a class="nav-link {% if '/rescuer/all' in request.path %} active {% endif %}"
href="{% url 'rescuer_all' %}">Finder</a> href="{% url 'rescuer_all' %}">alle Retter</a>
</li> </li>
{% endif %}
</ul>
<ul class="navbar-nav pull-right">
{% if user.is_authenticated %}
<li class="nav-item">
<a class="nav-link {% if '/accounts/email/' in request.path %} active {% endif %}"
href="{% url 'account_email' %}">Profile</a>
</li>
<li class="class-item">
<a class="nav-link" href="{% url 'account_logout' %}">Logout</a>
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'account_login' %}">Login</a>
</li>
{% endif %}
</ul> </ul>
</div> </div>
</div> </div>