Merge branch 'allauth' into 'master'

Allauth

See merge request bde/photo21!6
This commit is contained in:
aeltheos 2021-10-11 19:09:40 +02:00
commit e91e79ad85
22 changed files with 222 additions and 352 deletions

View file

@ -1,5 +0,0 @@
from django.apps import AppConfig
class Accounts(AppConfig):
name = 'accounts'

View file

@ -1,20 +0,0 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-2.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags %}
{% block title %}{% trans "Sign up" %}{% endblock %}
{% block content %}
<div class="card bg-light">
<h3 class="card-header text-center">
{% trans "Sign up" %}
</h3>
<div class="card-body">
<form method="post">{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="Envoyer" class="btn btn-primary mt-4">
</form>
</div>
</div>
{% endblock %}

View file

@ -1,6 +0,0 @@
from django.urls import path
from .views import signup
urlpatterns = [
path('registration/', signup, name='registration'),
]

View file

@ -1,20 +0,0 @@
from django.contrib.auth import login
from django.shortcuts import redirect, render
from .forms import RegistrationForm
def signup(request):
if request.method == 'POST':
form = RegistrationForm(request.POST)
if form.is_valid():
user = form.save()
user.first_name = form.cleaned_data.get('first_name')
user.last_name = form.cleaned_data.get('last_name')
user.email = form.cleaned_data.get('email')
login(request, user)
return redirect('/')
return render(request, 'accounts/registration.html', {'form': form})
else:
form = RegistrationForm()
return render(request, 'accounts/registration.html', {'form': form})

View file

@ -1,18 +1,16 @@
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _
from allauth.account.forms import SignupForm
class RegistrationForm(UserCreationForm):
email = forms.EmailField(
label=_("Email address"),
widget=forms.TextInput(),
required=True,
help_text=_(
class CustomSignupForm(SignupForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
# Add description on email field
self.fields["email"].help_text = _(
"Please enter a valid email address ending with `@crans.org` or "
"`@ens-paris-saclay.fr`."
),
)
def clean_email(self):
@ -25,7 +23,3 @@ class RegistrationForm(UserCreationForm):
_("Must end with `@crans.org` or `@ens-paris-saclay.fr`.")
)
return email
class Meta:
model = User
fields = ["username", "password1", "password2", "email"]

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-08 11:03+0000\n"
"POT-Creation-Date: 2021-10-11 11:48+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -34,25 +34,19 @@ msgstr ""
msgid "Must end with `@crans.org` or `@ens-paris-saclay.fr`."
msgstr "Doit finir par `@crans.org` ou `@ens-paris-saclay.fr`."
#: accounts/templates/accounts/registration.html:6
#: accounts/templates/accounts/registration.html:11
#: photo21/templates/base.html:70
msgid "Sign up"
msgstr "Inscription"
#: photo21/settings.py:132
#: photo21/settings.py:144
msgid "German"
msgstr ""
#: photo21/settings.py:133
#: photo21/settings.py:145
msgid "English"
msgstr ""
#: photo21/settings.py:134
#: photo21/settings.py:146
msgid "Spanish"
msgstr ""
#: photo21/settings.py:135
#: photo21/settings.py:147
msgid "French"
msgstr ""
@ -100,6 +94,58 @@ msgid ""
"soon. You can now drink a beer."
msgstr ""
#: photo21/templates/account/login.html:6
#: photo21/templates/account/login.html:11
#: photo21/templates/account/login.html:39
msgid "Sign In"
msgstr ""
#: photo21/templates/account/login.html:16
#, python-format
msgid ""
"Please sign in with one of your existing third party accounts. Or, <a href="
"\"%(signup_url)s\">sign up</a> for a %(site_name)s account and sign in below:"
msgstr ""
"Veuillez vous connectez avec un de vos comptes existants. Sinon, <a href="
"\"%(signup_url)s\">inscrivez-vous</a> pour un compte sur %(site_name)s et "
"identifiez-vous ci-dessous :"
#: photo21/templates/account/login.html:24
msgid "or"
msgstr ""
#: photo21/templates/account/login.html:30
#, python-format
msgid ""
"If you have not created an account yet, then please <a href=\"%(signup_url)s"
"\">sign up</a> first."
msgstr ""
"Si vous n'avez pas déjà créé de compte, veuillez vous <a href="
"\"%(signup_url)s\">inscrire</a>."
#: photo21/templates/account/login.html:40
msgid "Forgot Password?"
msgstr ""
#: photo21/templates/account/login.html:44
msgid "If any problem, please contact the server owners at"
msgstr "En cas de problème, contactez les administrateurs à"
#: photo21/templates/account/signup.html:6
msgid "Signup"
msgstr ""
#: photo21/templates/account/signup.html:11
#: photo21/templates/account/signup.html:22
msgid "Sign Up"
msgstr ""
#: photo21/templates/account/signup.html:14
#, python-format
msgid ""
"Already have an account? Then please <a href=\"%(login_url)s\">sign in</a>."
msgstr ""
#: photo21/templates/base.html:12
msgid "The ENS Paris-Saclay pictures server."
msgstr ""
@ -109,106 +155,29 @@ msgid "Galleries"
msgstr "Galeries"
#: photo21/templates/base.html:39
msgid "Admin"
msgstr ""
msgid "Manage"
msgstr "Gestion"
#: photo21/templates/base.html:51
#: photo21/templates/base.html:50
msgid "Account"
msgstr "Compte"
#: photo21/templates/base.html:59
msgid "Log out"
msgstr ""
#: photo21/templates/base.html:61 photo21/templates/registration/login.html:6
#: photo21/templates/registration/login.html:11
#: photo21/templates/registration/login.html:33
#: photo21/templates/registration/password_reset_complete.html:15
#: photo21/templates/base.html:69
msgid "Log in"
msgstr ""
#: photo21/templates/base.html:78
msgid "Sign up"
msgstr "Inscription"
#: photo21/templates/index.html:53
msgid "Connected as"
msgstr "Connecté en tant que"
#: photo21/templates/registration/logged_out.html:13
msgid "Thanks for spending some quality time with the Web site today."
msgstr ""
#: photo21/templates/registration/logged_out.html:14
msgid "Log in again"
msgstr ""
#: photo21/templates/registration/login.html:16
#, python-format
msgid ""
"You are authenticated as %(username)s, but are not authorized to access this "
"page. Would you like to login to a different account?"
msgstr ""
#: photo21/templates/registration/login.html:25
msgid ""
"You must be logged with a staff account with the higher mask to access "
"Django Admin."
msgstr ""
#: photo21/templates/registration/login.html:35
msgid "Forgotten your password or username?"
msgstr ""
#: photo21/templates/registration/login.html:39
msgid "If any problem, please contact the server owners at"
msgstr "En cas de problème, contactez les administrateurs à"
#: photo21/templates/registration/password_change_done.html:13
msgid "Your password was changed."
msgstr ""
#: photo21/templates/registration/password_change_form.html:14
msgid ""
"Please enter your old password, for security's sake, and then enter your new "
"password twice so we can verify you typed it in correctly."
msgstr ""
#: photo21/templates/registration/password_change_form.html:16
#: photo21/templates/registration/password_reset_confirm.html:17
msgid "Change my password"
msgstr ""
#: photo21/templates/registration/password_reset_complete.html:13
msgid "Your password has been set. You may go ahead and log in now."
msgstr ""
#: photo21/templates/registration/password_reset_confirm.html:14
msgid ""
"Please enter your new password twice so we can verify you typed it in "
"correctly."
msgstr ""
#: photo21/templates/registration/password_reset_confirm.html:21
msgid ""
"The password reset link was invalid, possibly because it has already been "
"used. Please request a new password reset."
msgstr ""
#: photo21/templates/registration/password_reset_done.html:13
msgid ""
"We've emailed you instructions for setting your password, if an account "
"exists with the email you entered. You should receive them shortly."
msgstr ""
#: photo21/templates/registration/password_reset_done.html:14
msgid ""
"If you don't receive an email, please make sure you've entered the address "
"you registered with, and check your spam folder."
msgstr ""
#: photo21/templates/registration/password_reset_form.html:13
msgid ""
"Forgotten your password? Enter your email address below, and we'll email "
"instructions for setting a new one."
msgstr ""
#: photo21/templates/registration/password_reset_form.html:18
msgid "Reset my password"
msgstr ""
#: photologue_custom/templates/photologue/gallery_archive.html:4
#: photologue_custom/templates/photologue/gallery_archive.html:9
msgid "Latest photo galleries"

View file

@ -13,6 +13,7 @@ https://docs.djangoproject.com/en/2.2/ref/settings/
import os
from django.utils.translation import gettext_lazy as _
from django.contrib.messages import constants as messages
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@ -41,10 +42,12 @@ INSTALLED_APPS = [
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'allauth',
'allauth.account',
'allauth.socialaccount',
'crispy_forms',
'photologue_custom',
'photologue',
'accounts',
'sortedm2m',
'taggit',
]
@ -81,6 +84,14 @@ 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 = 'photo21.wsgi.application'
@ -155,6 +166,17 @@ LOCALE_PATHS = [os.path.join(BASE_DIR, 'photo21/locale')]
FIXTURE_DIRS = [os.path.join(BASE_DIR, 'note_kfet/fixtures')]
# Email settings
if DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
else:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_SSL = os.getenv('EMAIL_USE_SSL', False)
EMAIL_HOST = os.getenv('EMAIL_HOST', 'smtp.crans.org')
EMAIL_PORT = os.getenv('EMAIL_PORT', 25)
EMAIL_HOST_USER = os.getenv('EMAIL_USER', None)
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_PASSWORD', None)
# Mail will be sent from this address
SERVER_EMAIL = "photos@crans.org"
DEFAULT_FROM_EMAIL = f"Serveur photos <{SERVER_EMAIL}>"
@ -168,7 +190,22 @@ SESSION_COOKIE_AGE = 60 * 60 * 3
# Use only one Django Sites
SITE_ID = 1
# use Bootstrap forms
# Django message
MESSAGE_TAGS = {
messages.DEBUG: 'alert-secondary',
messages.INFO: 'alert-info',
messages.SUCCESS: 'alert-success',
messages.WARNING: 'alert-warning',
messages.ERROR: 'alert-danger',
}
# Allauth configuration
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_AUTHENTICATION_METHOD = "username_email"
ACCOUNT_FORMS = {'signup': 'photo21.forms.CustomSignupForm'}
# Use Bootstrap forms
CRISPY_TEMPLATE_PACK = 'bootstrap4'
# Photologue

View file

@ -0,0 +1,13 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-2.0-or-later
{% endcomment %}
{% block title %}{% block head_title %}{% endblock %}{% endblock title %}
{% block extracss %}
<style>
.asteriskField { display: none; }
.form-group { margin-top: 0.5em;}
</style>
{% endblock %}

View file

@ -0,0 +1,45 @@
{% extends "account/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-2.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags account socialaccount %}
{% block head_title %}{% trans "Sign In" %}{% endblock %}
{% block content %}
<div class="card bg-light mx-auto" style="max-width: 35rem;">
<h3 class="card-header text-center">
{% trans "Sign In" %}
</h3>
<div class="card-body">
{% get_providers as socialaccount_providers %}
{% if socialaccount_providers %}
<p>{% blocktrans trimmed 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 trimmed %}If you have not created an account yet, then please
<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
{% endif %}
<form 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 %}
<button type="submit" class="btn btn-primary mt-2">{% trans "Sign In" %}</button>
<a class="btn mt-2" href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
</form>
</div>
</div>
<p class="small text-center mt-1">{% trans "If any problem, please contact the server owners at" %} <code>photos[at]crans.org</code>.</p>
{% endblock %}

View file

@ -0,0 +1,26 @@
{% extends "account/base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-2.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags %}
{% block head_title %}{% trans "Signup" %}{% endblock %}
{% block content %}
<div class="card bg-light">
<h3 class="card-header text-center">
{% trans "Sign Up" %}
</h3>
<div class="card-body">
<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 type="submit" class="btn btn-primary mt-2">{% trans "Sign Up" %} &raquo;</button>
</form>
</div>
</div>
{% endblock %}

View file

@ -36,14 +36,22 @@ SPDX-License-Identifier: GPL-3.0-or-later
</li>
{% if request.user.is_staff %}
<li class="nav-item">
<a class="nav-link" href="{% url 'admin:index' %}">{% trans 'Admin' %}</a>
<a class="nav-link" href="{% url 'admin:index' %}">{% trans 'Manage' %}</a>
</li>
{% endif %}
</ul>
<ul class="navbar-nav">
{% if request.user.is_authenticated %}
<li class="nav-item">
<a class="nav-link" href="{% url 'logout' %}">
<a class="nav-link" href="{% url 'account_email' %}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person" viewBox="0 0 16 16">
<path d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10z"/>
</svg>
{% trans "Account" %}
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'account_logout' %}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M10 12.5a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v2a.5.5 0 0 0 1 0v-2A1.5 1.5 0 0 0 9.5 2h-8A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-2a.5.5 0 0 0-1 0v2z"/>
<path fill-rule="evenodd" d="M15.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708.708L14.293 7.5H5.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
@ -53,7 +61,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</li>
{% else %}
<li class="nav-item">
<a class="nav-link" href="{% url 'login' %}">
<a class="nav-link" href="{% url 'account_login' %}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-in-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M6 3.5a.5.5 0 0 1 .5-.5h8a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-8a.5.5 0 0 1-.5-.5v-2a.5.5 0 0 0-1 0v2A1.5 1.5 0 0 0 6.5 14h8a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2h-8A1.5 1.5 0 0 0 5 3.5v2a.5.5 0 0 0 1 0v-2z"/>
<path fill-rule="evenodd" d="M11.854 8.354a.5.5 0 0 0 0-.708l-3-3a.5.5 0 1 0-.708.708L10.293 7.5H1.5a.5.5 0 0 0 0 1h8.793l-2.147 2.146a.5.5 0 0 0 .708.708l3-3z"/>
@ -62,7 +70,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'registration' %}">
<a class="nav-link" href="{% url 'account_signup' %}">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-person-plus" viewBox="0 0 16 16">
<path d="M6 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm4 8c0 1-1 1-1 1H1s-1 0-1-1 1-4 6-4 6 3 6 4zm-1-.004c-.001-.246-.154-.986-.832-1.664C9.516 10.68 8.289 10 6 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10z"/>
<path fill-rule="evenodd" d="M13.5 5a.5.5 0 0 1 .5.5V7h1.5a.5.5 0 0 1 0 1H14v1.5a.5.5 0 0 1-1 0V8h-1.5a.5.5 0 0 1 0-1H13V5.5a.5.5 0 0 1 .5-.5z"/>
@ -77,6 +85,12 @@ SPDX-License-Identifier: GPL-3.0-or-later
</nav>
<main class="container my-3">
{% for message in messages %}
<div class="alert {{ message.tags }} alert-dismissible" role="alert" >
{{ message }}
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
{% endfor %}
{% block content %}
<p>Default content...</p>
{% endblock %}

View file

@ -1,17 +0,0 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n %}
{% block content %}
<div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<p>{% trans "Thanks for spending some quality time with the Web site today." %}</p>
<p><a href="{% url 'index' %}">{% trans 'Log in again' %}</a></p>
</div>
</div>
{% endblock %}

View file

@ -1,40 +0,0 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-2.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags %}
{% block title %}{% trans "Log in" %}{% endblock %}
{% block content %}
<div class="card bg-light mx-auto" style="max-width: 35rem;">
<h3 class="card-header text-center">
{% trans "Log in" %}
</h3>
<div class="card-body">
{% if user.is_authenticated %}
<div class="alert alert-warning">
{% blocktrans trimmed with username=request.user.username %}
You are authenticated as {{ username }}, but are not authorized to
access this page. Would you like to login to a different account?
{% endblocktrans %}
</div>
{% endif %}
{% if request.resolver_match.view_name == 'admin:login' %}
<div class="alert alert-info">
{% blocktrans trimmed %}
You must be logged with a staff account with the higher mask to access Django Admin.
{% endblocktrans %}
</div>
{% endif %}
<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
{{ form|crispy }}
<input type="submit" value="{% trans 'Log in' %}" class="btn btn-primary btn-lg mt-2">
<a href="{% url 'password_reset' %}"
class="badge bg-light text-dark">{% trans 'Forgotten your password or username?' %}</a>
</form>
</div>
</div>
<p class="small text-center mt-1">{% trans "If any problem, please contact the server owners at" %} <code>photos[at]crans.org</code>.</p>
{% endblock %}

View file

@ -1,16 +0,0 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n %}
{% block content %}
<div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<p>{% trans 'Your password was changed.' %}</p>
</div>
</div>
{% endblock %}

View file

@ -1,20 +0,0 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags %}
{% block content %}
<div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<form method="post">{% csrf_token %}
<p>{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}</p>
{{ form|crispy }}
<input class="btn btn-primary" type="submit" value="{% trans 'Change my password' %}">
</form>
</div>
</div>
{% endblock %}

View file

@ -1,19 +0,0 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n %}
{% block content %}
<div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<p>{% trans "Your password has been set. You may go ahead and log in now." %}</p>
<p>
<a href="{{ login_url }}" class="btn btn-success">{% trans 'Log in' %}</a>
</p>
</div>
</div>
{% endblock %}

View file

@ -1,26 +0,0 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags %}
{% block content %}
<div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
{% if validlink %}
<p>{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}</p>
<form method="post">{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary mt-4" type="submit" value="{% trans 'Change my password' %}">
</form>
{% else %}
<p>
{% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %}
</p>
{% endif %}
</div>
</div>
{% endblock %}

View file

@ -1,17 +0,0 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n %}
{% block content %}
<div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<p>{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}</p>
<p>{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}</p>
</div>
</div>
{% endblock %}

View file

@ -1,22 +0,0 @@
{% extends "base.html" %}
{% comment %}
SPDX-License-Identifier: GPL-3.0-or-later
{% endcomment %}
{% load i18n crispy_forms_tags %}
{% block content %}
<div class="card bg-light">
<h3 class="card-header text-center">
{{ title }}
</h3>
<div class="card-body">
<p>{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}</p>
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<input class="btn btn-primary mt-4" type="submit" value="{% trans 'Reset my password' %}">
</form>
</div>
</div>
{% endblock %}

View file

@ -25,8 +25,7 @@ urlpatterns = [
path('', IndexView.as_view(), name='index'),
path('photologue/', include('photologue_custom.urls')),
path('photologue/', include('photologue.urls', namespace='photologue')),
path('accounts/', include('django.contrib.auth.urls')),
path('accounts/', include('accounts.urls')),
path('accounts/', include('allauth.urls')),
path('i18n/', include('django.conf.urls.i18n')),
path('admin/', admin.site.urls),
path('admin/doc/', include('django.contrib.admindocs.urls')),

View file

@ -2,3 +2,4 @@ Django~=2.2.20
django-photologue~=3.13
django-taggit>=0.24.0
django-crispy-forms~=1.7
django-allauth>=0.44

View file

@ -18,7 +18,7 @@ deps =
-r{toxinidir}/requirements.txt
coverage
commands =
coverage run --omit='photo21/wsgi.py' --source=photo21,photologue_custom,accounts ./manage.py test
coverage run --omit='photo21/wsgi.py' --source=photo21,photologue_custom ./manage.py test
coverage report -m
[testenv:linters]
@ -32,7 +32,7 @@ deps =
pep8-naming
pyflakes
commands =
flake8 photo21 photologue_custom accounts
flake8 photo21 photologue_custom
[flake8]
ignore = W503, I100, I101