Skip to content

Commit 8d516b4

Browse files
Bump django-allauth from 0.51.0 to 65.13.0 in /requirements (mozilla#3867)
In addition to resolving all backwards incompatibilities from 0.51.0 to 65.13.0, this PR also drops the redirect on Email consent page, because it was buggy.
1 parent 879bbab commit 8d516b4

14 files changed

Lines changed: 190 additions & 159 deletions

File tree

pontoon/allauth_urls.py

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
views and don't allow user to tamper with the state of an account.
55
"""
66

7-
import importlib
8-
97
from allauth.account import views as account_views
10-
from allauth.socialaccount import providers, views as socialaccount_views
8+
from allauth.socialaccount import views as socialaccount_views
9+
from allauth.urls import build_provider_urlpatterns
1110

1211
from django.conf import settings
1312
from django.contrib.auth import views
@@ -25,26 +24,19 @@
2524
]
2625
else:
2726
urlpatterns = [
27+
path("signup/", account_views.signup, name="account_signup"),
2828
path("login/", account_views.login, name="account_login"),
2929
path("logout/", account_views.logout, name="account_logout"),
3030
path("inactive/", account_views.account_inactive, name="account_inactive"),
3131
path(
32-
"social/login/cancelled/",
32+
"/login/cancelled/",
3333
socialaccount_views.login_cancelled,
3434
name="socialaccount_login_cancelled",
3535
),
3636
path(
37-
"social/login/error/",
37+
"/login/error/",
3838
socialaccount_views.login_error,
3939
name="socialaccount_login_error",
4040
),
4141
]
42-
43-
for provider in providers.registry.get_list():
44-
try:
45-
prov_mod = importlib.import_module(provider.get_package() + ".urls")
46-
except ImportError:
47-
continue
48-
prov_urlpatterns = getattr(prov_mod, "urlpatterns", None)
49-
if prov_urlpatterns:
50-
urlpatterns += prov_urlpatterns
42+
urlpatterns += build_provider_urlpatterns()

pontoon/base/templates/django/account/account_inactive.html renamed to pontoon/base/templates/account/account_inactive.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "base.html" %}
1+
{% extends "allauth/layouts/base.html" %}
22
{% load static %}
33

44
{% block title %}Account Disabled{% endblock %}
File renamed without changes.

pontoon/base/templates/django/account/base.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

pontoon/base/templates/django/socialaccount/base.html

Lines changed: 0 additions & 1 deletion
This file was deleted.

pontoon/base/templates/registration/login.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends 'django/base.html' %}
1+
{% extends "allauth/layouts/base.html" %}
22

33
{% block content %}
44
<h1 id="title">Pontoon</h1>

pontoon/base/templates/django/socialaccount/authentication_error.html renamed to pontoon/base/templates/socialaccount/authentication_error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "socialaccount/base.html" %}
1+
{% extends "allauth/layouts/base.html" %}
22

33
{% load socialaccount %}
44

pontoon/base/templatetags/helpers.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import markupsafe
1010

11-
from allauth.socialaccount import providers
11+
from allauth.socialaccount.adapter import get_adapter
1212
from allauth.utils import get_request_param
1313
from bleach.linkifier import Linker
1414
from django_jinja import library
@@ -210,7 +210,7 @@ def provider_login_url(request, provider_id=settings.AUTHENTICATION_METHOD, **qu
210210
This function adapts the django-allauth templatetags that don't support jinja2.
211211
@TODO: land support for the jinja2 tags in the django-allauth.
212212
"""
213-
provider = providers.registry.by_id(provider_id)
213+
provider = get_adapter().get_provider(request, provider_id)
214214

215215
auth_params = query.get("auth_params", None)
216216
process = query.get("process", None)
@@ -233,9 +233,9 @@ def provider_login_url(request, provider_id=settings.AUTHENTICATION_METHOD, **qu
233233
@library.global_function
234234
def providers_media_js(request):
235235
"""A port of django tag into jinja2"""
236-
return markupsafe.Markup(
237-
"\n".join([p.media_js(request) for p in providers.registry.get_list()])
238-
)
236+
providers_list = get_adapter(request).list_providers(request)
237+
ret = "\n".join(p.media_js(request) for p in providers_list)
238+
return markupsafe.Markup(ret)
239239

240240

241241
@library.filter

pontoon/messaging/static/js/email_consent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ $(function () {
1010
csrfmiddlewaretoken: $('body').data('csrf'),
1111
value: self.is('.enable'),
1212
},
13-
success: function (data) {
14-
window.location.href = data.next;
13+
success() {
14+
window.location.href = '/';
1515
},
1616
error: function (request) {
1717
if (request.responseText === 'error') {

pontoon/messaging/tests/test_views.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ def test_dismiss_email_consent(member):
1919
assert profile.email_communications_enabled is False
2020
assert profile.email_consent_dismissed_at is not None
2121
assert response.status_code == 200
22-
assert response.json()["next"] == "/"
2322

2423
params = {
2524
"value": "true",
@@ -29,4 +28,3 @@ def test_dismiss_email_consent(member):
2928
assert profile.email_communications_enabled is True
3029
assert profile.email_consent_dismissed_at is not None
3130
assert response.status_code == 200
32-
assert response.json()["next"] == "/"

0 commit comments

Comments
 (0)