Skip to content

Commit b9607d9

Browse files
authored
Merge pull request #796 from crowdbotics/PI-258-add-allauth-middleware
Add allauth AccountMiddleware to MIDDLEWARE list
2 parents 294bb65 + 8a57158 commit b9607d9

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

{{cookiecutter.project_slug}}/home/api/v1/serializers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from django.utils.translation import gettext_lazy as _
44
from allauth.account import app_settings as allauth_settings
55
from allauth.account.forms import ResetPasswordForm
6-
from allauth.utils import email_address_exists, generate_unique_username
6+
from allauth.utils import generate_unique_username
7+
from allauth.account.utils import assess_unique_email
78
from allauth.account.adapter import get_adapter
89
from allauth.account.utils import setup_user_email
910
from rest_framework import serializers
@@ -38,7 +39,7 @@ def _get_request(self):
3839
def validate_email(self, email):
3940
email = get_adapter().clean_email(email)
4041
if allauth_settings.UNIQUE_EMAIL:
41-
if email and email_address_exists(email):
42+
if email and assess_unique_email(email):
4243
raise serializers.ValidationError(
4344
_("A user is already registered with this e-mail address.")
4445
)

{{cookiecutter.project_slug}}/home/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{% raw %}
2-
{% load staticfiles %}
2+
{% load static %}
33
<!doctype html>
44
<html lang="en">
55
<head>

{{cookiecutter.project_slug}}/home/templates/home/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% raw %}
22
{% extends '../base.html' %}
3-
{% load staticfiles %}
3+
{% load static %}
44
{% load bootstrap4 %}
55

66
{% block content %}

{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@
114114
'django.contrib.auth.middleware.AuthenticationMiddleware',
115115
'django.contrib.messages.middleware.MessageMiddleware',
116116
'django.middleware.clickjacking.XFrameOptionsMiddleware',
117+
'allauth.account.middleware.AccountMiddleware',
117118
]
118119

119120
ROOT_URLCONF = '{{cookiecutter.project_slug}}.urls'
@@ -284,7 +285,7 @@
284285
EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend"
285286

286287

287-
# GCP config
288+
# GCP config
288289
def google_service_account_config():
289290
# base64 encoded service_account.json file
290291
service_account_config = env.str("GS_CREDENTIALS", "")

0 commit comments

Comments
 (0)