Skip to content

Commit

Permalink
[deps] Update django-allauth requirement from ~=0.54.0 to ~=0.63.6
Browse files Browse the repository at this point in the history
Updates the requirements on [django-allauth](https://github.com/pennersr/django-allauth) to permit the latest version.
- [Changelog](https://github.com/pennersr/django-allauth/blob/main/ChangeLog.rst)
- [Commits](pennersr/django-allauth@0.54.0...0.63.6)

---
updated-dependencies:
- dependency-name: django-allauth
  dependency-type: direct:production
...

* [ci] Run test without parallel when test suite fails
* [tests] Fixed tests
* [deps] Bumped django-allauth~=0.63.6 
   (django-allauth>0.63.6 dropped support for Django 3.2 and we still support Django 3.2 for now)
* [chores] Fixed allauth template heirarchy
* [req-changes] Fixed CSS

---------

Signed-off-by: Gagan Deep <pandafy.dev@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
dependabot[bot] authored Aug 23, 2024
1 parent d4d90b6 commit 17a6f00
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Tests
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
run: |
coverage run ./runtests.py --parallel
coverage run ./runtests.py --parallel || ./runtests.py
SAMPLE_APP=1 coverage run ./runtests.py --parallel
# basic tests without allauth.socialaccount
NO_SOCIAL_APP=1 coverage run ./tests/manage.py test testapp.tests.test_admin.TestUsersAdmin --parallel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ form.password_change label {
font-size: 15px;
font-weight: bold;
}
#id_password1_helptext ul {
padding-left: 170px;
}
#id_password1_helptext li {
list-style: none;
}

@media (max-width: 767px) {
#main form.password_change label {
Expand All @@ -50,4 +56,7 @@ form.password_change label {
padding-right: 0;
padding-left: 0;
}
#id_password1_helptext ul {
padding-left: 0px;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "admin/base_site.html" %}
{% extends "account/base_entrance.html" %}

{% load i18n %}
{% load account %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "account/base_entrance.html" %}
{% load i18n %}

{% block extrastyle %}
Expand Down
5 changes: 4 additions & 1 deletion openwisp_users/accounts/templates/account/login.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "account/base_entrance.html" %}

{% load i18n %}
{% block head_title %}{% trans "Sign In" %}{% endblock %}
Expand All @@ -9,6 +9,9 @@
#content p label {
margin-right: 5px;
}
#id_password + span {
display: none;
}
</style>
{% endblock extrastyle %}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "account/base_manage.html" %}
{% load i18n %}

{% block extrastyle %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "account/base_manage.html" %}

{% load i18n %}
{% load static %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "account/base_manage.html" %}
{% load i18n %}

{% block extrastyle %}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "account/base.html" %}
{% extends "account/base_manage.html" %}
{% load i18n %}

{% block extrastyle %}
Expand Down
2 changes: 1 addition & 1 deletion openwisp_users/accounts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
if app_settings.SOCIALACCOUNT_ENABLED:
urlpatterns += [path('social/', include('allauth.socialaccount.urls'))]

for provider in providers.registry.get_list():
for provider in providers.registry.get_class_list():
try:
prov_mod = import_module(provider.get_package() + '.urls')
except ImportError:
Expand Down
8 changes: 4 additions & 4 deletions openwisp_users/accounts/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from allauth.account.forms import ChangePasswordForm as BaseChangePasswordForm
from allauth.account.views import PasswordChangeView as BasePasswordChangeView
from allauth.account.views import sensitive_post_parameters_m
from django import forms
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import login_required
Expand Down Expand Up @@ -27,12 +28,11 @@ def get_initial(self):
data['next'] = self.request.GET.get(REDIRECT_FIELD_NAME)
return data

def render_to_response(self, context, **response_kwargs):
@sensitive_post_parameters_m
def dispatch(self, request, *args, **kwargs):
if not self.request.user.has_usable_password():
return render(self.request, 'account/password_not_required.html')
return super(PasswordChangeView, self).render_to_response(
context, **response_kwargs
)
return super().dispatch(request, *args, **kwargs)


password_change = login_required(PasswordChangeView.as_view())
Expand Down
2 changes: 1 addition & 1 deletion openwisp_users/password_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ def validate(self, password, user=None):
)

def get_help_text(self):
return ''
return _('Your password cannot be the same as your current password.')
2 changes: 1 addition & 1 deletion openwisp_users/tests/test_accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _test_expired_user_password_reset(self, user):
self.assertEqual(
response.request.get('PATH_INFO'), reverse('account_reset_password_done')
)
self.assertContains(response, 'We have sent you an e-mail')
self.assertContains(response, 'We have sent you an email')
email = mail.outbox.pop()
password_reset_url = re.search(r'https?://[^\s]+', email.body).group(0)
response = self.client.get(
Expand Down
4 changes: 2 additions & 2 deletions openwisp_users/tests/test_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_assertion_not_raised_when_html_template_missing(self, mail_func):
self.client.post(reverse('account_reset_password'), params, follow=True)
send_mail_calls = mail_func.call_args_list
send_mail_arguments = send_mail_calls[0][0]
self.assertEqual(send_mail_arguments[0], '[example.com] Password Reset E-mail')
self.assertEqual(send_mail_arguments[0], '[example.com] Password Reset Email')
self.assertEqual(send_mail_arguments[2], '')

def test_password_reset_email_sent(self):
Expand All @@ -41,5 +41,5 @@ def test_password_reset_email_sent(self):
self.assertEqual(len(mail.outbox), 1)
email = mail.outbox.pop()
self.assertFalse(email.alternatives)
self.assertIn('Password Reset E-mail', email.subject)
self.assertIn('Password Reset Email', email.subject)
self.assertIn('Click the link below to reset your password', email.body)
14 changes: 9 additions & 5 deletions openwisp_users/tests/test_api/test_api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import django
from allauth.account.models import EmailAddress
from django.contrib import auth
from django.contrib.auth import get_user_model
Expand Down Expand Up @@ -438,8 +439,9 @@ def test_post_email_list_api(self):
user1 = self._create_user(username='user1', email='user1@email.com')
self.assertEqual(EmailAddress.objects.filter(user=user1).count(), 1)
path = reverse('users:email_list', args=(user1.pk,))
data = {'email': 'newemail@test.com', 'primary': True}
with self.assertNumQueries(7):
data = {'email': 'newemail@test.com'}
expected_queries = 7 if django.VERSION < (4, 0) else 9
with self.assertNumQueries(expected_queries):
response = self.client.post(path, data, content_type='application/json')
self.assertEqual(response.status_code, 201)
self.assertEqual(response.data['email'], 'newemail@test.com')
Expand All @@ -461,12 +463,13 @@ def test_get_email_list_multitenancy_api(self):
self.assertEqual(response.status_code, 404)

def test_put_email_update_api(self):
user1 = self._create_user(username='user1', email='user1@email.com')
user1 = self._create_user(username='user2', email='user2@email.com')
self.assertEqual(EmailAddress.objects.filter(user=user1).count(), 1)
email_id = EmailAddress.objects.get(user=user1).id
path = reverse('users:email_update', args=(user1.pk, email_id))
data = {'email': 'emailchange@test.com', 'primary': True}
with self.assertNumQueries(9):
expected_queries = 9 if django.VERSION < (4, 0) else 11
with self.assertNumQueries(expected_queries):
response = self.client.put(path, data, content_type='application/json')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data['email'], 'emailchange@test.com')
Expand All @@ -476,7 +479,8 @@ def test_patch_email_update_api(self):
email_id = EmailAddress.objects.get(user=user1).id
path = reverse('users:email_update', args=(user1.pk, email_id))
data = {'email': 'changemail@test.com'}
with self.assertNumQueries(9):
expected_queries = 9 if django.VERSION < (4, 0) else 11
with self.assertNumQueries(expected_queries):
response = self.client.patch(path, data, content_type='application/json')
self.assertEqual(response.status_code, 200)
self.assertEqual(
Expand Down
5 changes: 3 additions & 2 deletions openwisp_users/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from unittest.mock import patch

from allauth.account.models import EmailAddress
from allauth.account.models import EmailAddress, get_emailconfirmation_model
from django.contrib.auth import get_user_model
from django.core import mail
from django.core.exceptions import ValidationError
Expand All @@ -17,7 +17,7 @@
Organization = load_model('openwisp_users', 'Organization')
OrganizationUser = load_model('openwisp_users', 'OrganizationUser')
OrganizationOwner = load_model('openwisp_users', 'OrganizationOwner')
EmailConfirmation = load_model('account', 'EmailConfirmation')
EmailConfirmation = get_emailconfirmation_model()
User = get_user_model()


Expand Down Expand Up @@ -315,6 +315,7 @@ def test_orguser_is_admin_change(self):
)
def test_email_verification_success(self):
user = self._create_user()
user.emailaddress_set.update(verified=False)
email_address = user.emailaddress_set.first()
email_confirmation = EmailConfirmation.create(email_address)
email_confirmation.send()
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
django-organizations~=2.4.1
django-extensions~=3.2.3
django-allauth~=0.54.0
django-allauth~=0.63.6
django-phonenumber-field~=8.0.0
phonenumbers~=8.13.42
openwisp-utils[rest,celery] @ https://github.com/openwisp/openwisp-utils/tarball/master
Expand Down
1 change: 1 addition & 0 deletions tests/openwisp2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'allauth.account.middleware.AccountMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'openwisp_users.middleware.PasswordExpirationMiddleware',
Expand Down

0 comments on commit 17a6f00

Please sign in to comment.