Skip to content

Commit 60fda4a

Browse files
authored
Merge branch 'master' into feature/backport-workflow
2 parents ebe21ed + e904269 commit 60fda4a

10 files changed

Lines changed: 32 additions & 24 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
fail-fast: false
2525
matrix:
2626
python-version:
27-
- "3.9"
2827
- "3.10"
2928
- "3.11"
3029
- "3.12"
@@ -35,26 +34,19 @@ jobs:
3534
- django~=5.1.0
3635
- django~=5.2.0
3736
exclude:
38-
# Django 5.0+ requires Python >=3.10
39-
- python-version: "3.9"
40-
django-version: django~=5.0.0
41-
- python-version: "3.9"
42-
django-version: django~=5.1.0
43-
- python-version: "3.9"
44-
django-version: django~=5.2.0
4537
# Python 3.13 supported only in Django >=5.1.3
4638
- python-version: "3.13"
4739
django-version: django~=4.2.0
4840
- python-version: "3.13"
4941
django-version: django~=5.0.0
5042

5143
steps:
52-
- uses: actions/checkout@v5
44+
- uses: actions/checkout@v6
5345
with:
5446
ref: ${{ github.event.pull_request.head.sha }}
5547

5648
- name: Cache APT packages
57-
uses: actions/cache@v4
49+
uses: actions/cache@v5
5850
with:
5951
path: /var/cache/apt/archives
6052
key: apt-${{ runner.os }}-${{ hashFiles('.github/workflows/ci.yml') }}

.github/workflows/pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
permissions:
1818
id-token: write
1919
steps:
20-
- uses: actions/checkout@v5
20+
- uses: actions/checkout@v6
2121
- name: Set up Python
2222
uses: actions/setup-python@v6
2323
with:

docs/developer/admin-utils.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ creating filters for related multitenant models.
6565

6666
Consider the following example from `IpAddressAdmin in openwisp-ipam
6767
<https://github.com/openwisp/openwisp-ipam/blob/956d9d25fc1ac339cb148ec7faf80046cc14be37/openwisp_ipam/admin.py#L216-L227>`_.
68-
``IpAddressAdmin`` allows filtering `IpAddress objects by ``Subnet``
68+
``IpAddressAdmin`` allows filtering ``IpAddress`` objects by ``Subnet``
6969
belonging to organizations managed by the user.
7070

7171
.. code-block:: python

docs/developer/extending.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ A Django app is nothing more than a `Python package
4444
of Python scripts). In the following examples, we'll call this Django app
4545
``myusers``, but you can name it however you like:
4646

47-
.. code-block::
47+
.. code-block:: bash
4848
4949
django-admin startapp myusers
5050
@@ -73,7 +73,7 @@ apps, please refer to the `Django documentation
7373

7474
Install (and add to the requirements of your project) openwisp-users:
7575

76-
.. code-block::
76+
.. code-block:: bash
7777
7878
pip install openwisp-users
7979
@@ -185,7 +185,7 @@ Substitute ``myusers`` with the name you chose in step 1.
185185

186186
Create database migrations:
187187

188-
.. code-block::
188+
.. code-block:: bash
189189
190190
./manage.py makemigrations
191191
@@ -196,7 +196,7 @@ contents of the `sample_users/migrations/0004_default_groups.py
196196

197197
Then, run the migrations:
198198

199-
.. code-block::
199+
.. code-block:: bash
200200
201201
./manage.py migrate
202202
@@ -361,7 +361,7 @@ to find out how to do this.
361361

362362
You can then run tests with:
363363

364-
.. code-block::
364+
.. code-block:: bash
365365
366366
# the --parallel flag is optional
367367
./manage.py test --parallel myusers

docs/developer/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Developer Docs
88

99
./installation.rst
1010
./admin-utils.rst
11-
./django-rest-framework-utils
11+
./django-rest-framework-utils.rst
1212
./misc-utils.rst
1313
./extending.rst
1414

docs/developer/misc-utils.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ The cache is automatically invalidated on the following events:
9696

9797
Usage example:
9898

99-
.. code-block::
99+
.. code-block:: python-console
100100
101101
>>> user.organizations_dict
102102
... {'20135c30-d486-4d68-993f-322b8acb51c4': {'is_admin': True, 'is_owner': False}}
@@ -110,7 +110,7 @@ Returns a list of primary keys of organizations the user can manage.
110110

111111
Usage example:
112112

113-
.. code-block::
113+
.. code-block:: python-console
114114
115115
>>> user.organizations_managed
116116
... ['20135c30-d486-4d68-993f-322b8acb51c4']
@@ -122,7 +122,7 @@ Returns a list of primary keys of organizations the user owns.
122122

123123
Usage example:
124124

125-
.. code-block::
125+
.. code-block:: python-console
126126
127127
>>> user.organizations_owned
128128
... ['20135c30-d486-4d68-993f-322b8acb51c4']

openwisp_users/accounts/adapter.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from allauth.account.adapter import DefaultAccountAdapter
2+
from django.contrib.sites.shortcuts import get_current_site
23
from django.template import TemplateDoesNotExist
34
from django.template.loader import render_to_string
45
from django.utils.translation import gettext as _
@@ -8,6 +9,8 @@
89

910
class EmailAdapter(DefaultAccountAdapter):
1011
def send_mail(self, template_prefix, email, context):
12+
if "current_site" not in context and hasattr(self, "request"):
13+
context["current_site"] = get_current_site(self.request)
1114
subject = render_to_string("{0}_subject.txt".format(template_prefix), context)
1215
subject = " ".join(subject.splitlines()).strip()
1316
subject = self.format_email_subject(subject)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
input.readonly {
2-
border: 1px solid rgba(0, 0, 0, 0.05) !important;
3-
background-color: rgba(0, 0, 0, 0.07);
2+
border: 1px solid var(--hairline-color) !important;
3+
background-color: var(--hairline-color);
44
}

openwisp_users/tests/test_adapter.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,16 @@ def test_password_reset_email_sent(self):
4343
self.assertFalse(email.alternatives)
4444
self.assertIn("Password Reset Email", email.subject)
4545
self.assertIn("Click the link below to reset your password", email.body)
46+
47+
def test_password_reset_includes_site_name(self):
48+
self._create_user()
49+
params = {"email": "test@tester.com"}
50+
self.client.post(reverse("account_reset_password"), params, follow=True)
51+
self.assertEqual(len(mail.outbox), 1)
52+
email = mail.outbox[0]
53+
# plain text body should contain example.com from site name
54+
self.assertIn("example.com", email.body)
55+
# if there is an HTML alternative, check it too
56+
if email.alternatives:
57+
html = email.alternatives[0][0]
58+
self.assertIn("example.com", html)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
django-organizations>=2.5.0,<2.6.0
22
django-extensions>=3.2,<4.2
33
django-allauth[socialaccount]>=65.12.0,<65.14.0
4-
django-phonenumber-field>=8.1.0,<8.2.0
4+
django-phonenumber-field>=8.1.0,<8.5.0
55
phonenumbers>=9.0.10,<9.1.0
66
openwisp-utils[rest,celery] @ https://github.com/openwisp/openwisp-utils/archive/refs/heads/1.3.tar.gz
77
packaging

0 commit comments

Comments
 (0)