django-auth-recovery-codes 1.0.0__py3-none-any.whl → 1.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of django-auth-recovery-codes might be problematic. Click here for more details.
- django_auth_recovery_codes/helpers.py +17 -36
- django_auth_recovery_codes/static/django_recovery_codes/js/helpers/handleCodeGeneration.js +4 -3
- {django_auth_recovery_codes-1.0.0.dist-info → django_auth_recovery_codes-1.0.2.dist-info}/METADATA +14 -3
- {django_auth_recovery_codes-1.0.0.dist-info → django_auth_recovery_codes-1.0.2.dist-info}/RECORD +7 -7
- {django_auth_recovery_codes-1.0.0.dist-info → django_auth_recovery_codes-1.0.2.dist-info}/WHEEL +0 -0
- {django_auth_recovery_codes-1.0.0.dist-info → django_auth_recovery_codes-1.0.2.dist-info}/licenses/LICENSE +0 -0
- {django_auth_recovery_codes-1.0.0.dist-info → django_auth_recovery_codes-1.0.2.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
|
-
from typing import Any
|
|
3
2
|
from uuid import UUID
|
|
4
3
|
|
|
5
|
-
from django.utils.timezone import localtime
|
|
6
|
-
from datetime import date, datetime
|
|
7
4
|
|
|
8
5
|
from django_auth_recovery_codes.models import RecoveryCodesBatch
|
|
9
6
|
from django_auth_recovery_codes.utils.errors.enforcer import enforce_types
|
|
@@ -118,22 +115,6 @@ class PurgedStatsCollector:
|
|
|
118
115
|
batch.user.id, batch.id, purged_count
|
|
119
116
|
)
|
|
120
117
|
|
|
121
|
-
def _format_datetime(self, value: Any) -> Any:
|
|
122
|
-
"""Return a timezone-aware ISO string for datetime, or None."""
|
|
123
|
-
|
|
124
|
-
if isinstance(value, datetime):
|
|
125
|
-
return localtime(value).isoformat()
|
|
126
|
-
if isinstance(value, date):
|
|
127
|
-
return value.isoformat()
|
|
128
|
-
return None
|
|
129
|
-
|
|
130
|
-
def _to_json_safe(self, value: Any) -> Any:
|
|
131
|
-
"""Convert datetimes and UUIDs into serialisable string forms."""
|
|
132
|
-
if isinstance(value, datetime):
|
|
133
|
-
return self._format_datetime(value)
|
|
134
|
-
if isinstance(value, UUID):
|
|
135
|
-
return str(value)
|
|
136
|
-
return value
|
|
137
118
|
|
|
138
119
|
def _generate_purged_batch_code_json_report(self, batch: RecoveryCodesBatch, purged_count: int, is_empty: bool, batch_id: UUID) -> dict:
|
|
139
120
|
"""
|
|
@@ -200,23 +181,23 @@ class PurgedStatsCollector:
|
|
|
200
181
|
"""
|
|
201
182
|
|
|
202
183
|
purged_batch_info = {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
184
|
+
"id": batch_id,
|
|
185
|
+
"number_issued": batch.number_issued,
|
|
186
|
+
"number_removed": purged_count,
|
|
187
|
+
"is_batch_empty": bool(is_empty),
|
|
188
|
+
"number_used": batch.number_used,
|
|
189
|
+
"number_remaining_in_batch": batch.active_codes_remaining,
|
|
190
|
+
"user_issued_to": getattr(batch.user, "username", str(batch.user) if batch.user else None),
|
|
191
|
+
"batch_creation_date": batch.created_at,
|
|
192
|
+
"last_modified": batch.modified_at,
|
|
193
|
+
"expiry_date": batch.expiry_date,
|
|
194
|
+
"deleted_at": batch.deleted_at,
|
|
195
|
+
"deleted_by": batch.deleted_by,
|
|
196
|
+
"was_codes_downloaded": bool(batch.downloaded),
|
|
197
|
+
"was_codes_viewed": bool(batch.viewed),
|
|
198
|
+
"was_codes_email": bool(batch.emailed),
|
|
199
|
+
"was_code_generated": bool(batch.generated),
|
|
200
|
+
}
|
|
220
201
|
|
|
221
202
|
self.batches_report.append(purged_batch_info)
|
|
222
203
|
return purged_batch_info
|
|
@@ -375,11 +375,12 @@ async function handleCanGenerateCodeSuccessUI(resp) {
|
|
|
375
375
|
const MILLI_SECONDS = 1000;
|
|
376
376
|
|
|
377
377
|
if (isPopulated) {
|
|
378
|
-
|
|
379
|
-
const
|
|
380
|
-
if (
|
|
378
|
+
|
|
379
|
+
const postResp = await sendPostFetchWithoutBody("/auth/recovery-codes/viewed/", "Failed to mark code as viewed ");
|
|
380
|
+
if (postResp && postResp.SUCCESS) {
|
|
381
381
|
markCurrentCardBatchAsViewed();
|
|
382
382
|
}
|
|
383
|
+
|
|
383
384
|
|
|
384
385
|
updateBatchHistorySection(recoveryBatchSectionElement, resp.BATCH, resp.ITEM_PER_PAGE);
|
|
385
386
|
|
{django_auth_recovery_codes-1.0.0.dist-info → django_auth_recovery_codes-1.0.2.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: django-auth-recovery-codes
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.2
|
|
4
4
|
Summary: Django app for 2FA recovery codes
|
|
5
5
|
Home-page: https://github.com/EgbieAndersonUku1/django_2fa_recovery_codes
|
|
6
6
|
Author: Egbie Uku
|
|
@@ -24,6 +24,11 @@ Requires-Dist: soupsieve>=2.7
|
|
|
24
24
|
Requires-Dist: sqlparse>=0.5
|
|
25
25
|
Requires-Dist: typing_extensions>=4.14
|
|
26
26
|
Requires-Dist: tzdata>=2025.2
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: black; extra == "dev"
|
|
29
|
+
Requires-Dist: flake8; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest; extra == "dev"
|
|
31
|
+
Requires-Dist: types-python-dateutil; extra == "dev"
|
|
27
32
|
Dynamic: author
|
|
28
33
|
Dynamic: author-email
|
|
29
34
|
Dynamic: home-page
|
|
@@ -1617,6 +1622,12 @@ pip install django
|
|
|
1617
1622
|
pip install django_auth_recovery_codes
|
|
1618
1623
|
```
|
|
1619
1624
|
|
|
1625
|
+
You can install the package with:
|
|
1626
|
+
|
|
1627
|
+
[`pip install django-auth-recovery-codes`](https://pypi.org/project/django-auth-recovery-codes/1.0.0/)
|
|
1628
|
+
|
|
1629
|
+
|
|
1630
|
+
|
|
1620
1631
|
### 6. Verify installation
|
|
1621
1632
|
|
|
1622
1633
|
```bash
|
|
@@ -2615,7 +2626,7 @@ DJANGO_AUTH_RECOVERY_CODES_DEFAULT_FORMAT = "txt"
|
|
|
2615
2626
|
# ===========================
|
|
2616
2627
|
|
|
2617
2628
|
DJANGO_AUTH_RECOVERY_CODES_SITE_NAME = "This is a demo tutorial page"
|
|
2618
|
-
DJANGO_AUTH_RECOVERY_CODE_REDIRECT_VIEW_AFTER_LOGOUT = "
|
|
2629
|
+
DJANGO_AUTH_RECOVERY_CODE_REDIRECT_VIEW_AFTER_LOGOUT = "logout_user" # redirect to a different page
|
|
2619
2630
|
|
|
2620
2631
|
# ===========================
|
|
2621
2632
|
# 💬 Recovery Code Email Success Message
|
|
@@ -2727,7 +2738,7 @@ Here are a few examples of how you can configure different flags in the applicat
|
|
|
2727
2738
|
|
|
2728
2739
|
```bash
|
|
2729
2740
|
DJANGO_AUTH_RECOVERY_CODE_MAX_VISIBLE = 20
|
|
2730
|
-
DJANGO_AUTH_RECOVERY_CODE_PER_PAGE =
|
|
2741
|
+
DJANGO_AUTH_RECOVERY_CODE_PER_PAGE = 5
|
|
2731
2742
|
````
|
|
2732
2743
|
|
|
2733
2744
|
* You can also customise the message displayed after a user emails themselves a copy of their recovery codes:
|
{django_auth_recovery_codes-1.0.0.dist-info → django_auth_recovery_codes-1.0.2.dist-info}/RECORD
RENAMED
|
@@ -7,7 +7,7 @@ django_auth_recovery_codes/checks.py,sha256=UD22TQtsbROiUzA62DrfnOi8iZ6UT-ghuk0b
|
|
|
7
7
|
django_auth_recovery_codes/conf.py,sha256=P0g2atBlvoJJNiNzSj9RWZiKJjwJ2kaUwzHJ1G1oJpw,12482
|
|
8
8
|
django_auth_recovery_codes/context_processors.py,sha256=auTpXfWw6AmJXHsKMvFbhUINWLqXLWmoDv27vOXV430,276
|
|
9
9
|
django_auth_recovery_codes/enums.py,sha256=w8PyZk9P3sUStYGO77zW4PN6DYU6FHdI7dEAwZ9pI8g,1980
|
|
10
|
-
django_auth_recovery_codes/helpers.py,sha256=
|
|
10
|
+
django_auth_recovery_codes/helpers.py,sha256=BKyJwhTAGC_APfRg1anV_V-BnJQqAQrIdIwYRLGEZYg,9081
|
|
11
11
|
django_auth_recovery_codes/models.py,sha256=0n4_ihskfxWX6Ev31KHYX04_l_ucNWzJfYKHlqq-b8o,96836
|
|
12
12
|
django_auth_recovery_codes/models_choices.py,sha256=pyHb83-1tuCrWNoM1oIU7Owtpi9thKNVfv5kOwp-Qxw,291
|
|
13
13
|
django_auth_recovery_codes/signals.py,sha256=AFAcSVu3kAGwrtV2l4F0FwBA7JELvsLv9RbnLDOEBW8,5710
|
|
@@ -52,7 +52,7 @@ django_auth_recovery_codes/static/django_recovery_codes/js/helpers/appMessages.j
|
|
|
52
52
|
django_auth_recovery_codes/static/django_recovery_codes/js/helpers/formUtils.js,sha256=OMSLr9695wQCax5U4hey_ViQGxCq6LWejMvA-K6VyrM,1407
|
|
53
53
|
django_auth_recovery_codes/static/django_recovery_codes/js/helpers/handleButtonAlertClicker.js,sha256=xB85xdvG4bDecD1xJNtR9fnIEWaJmQ6_lSBGQs1rcuk,6805
|
|
54
54
|
django_auth_recovery_codes/static/django_recovery_codes/js/helpers/handleCodeDelete.js,sha256=miCv4S3ZlN4xA_mPzSuLHBWGB3lsuZi26fWxnPOs3K0,11700
|
|
55
|
-
django_auth_recovery_codes/static/django_recovery_codes/js/helpers/handleCodeGeneration.js,sha256=
|
|
55
|
+
django_auth_recovery_codes/static/django_recovery_codes/js/helpers/handleCodeGeneration.js,sha256=9y4nn4NNs8iKtmpZh-Lc199QxmrihosKL-Q3eIfVI70,24856
|
|
56
56
|
django_auth_recovery_codes/static/django_recovery_codes/js/helpers/handleDownload.js,sha256=ZHnBjeCuGq6z30fwiNIN9FPkiCPR8Grt0MfH_06fmq8,10699
|
|
57
57
|
django_auth_recovery_codes/static/django_recovery_codes/js/helpers/handleEmail.js,sha256=1TPrJd55J4CJYkiFEYPa9tgdGvDKmkWgF00N3WZeHs0,5984
|
|
58
58
|
django_auth_recovery_codes/static/django_recovery_codes/js/helpers/handleInvalidation.js,sha256=tkzfclOXKaM5Nui8QYeyGizq_LtXAmhqBlTqMdpOhuQ,6127
|
|
@@ -5798,8 +5798,8 @@ django_auth_recovery_codes/utils/exporters/file_converters.py,sha256=TVRcLr-2Vgh
|
|
|
5798
5798
|
django_auth_recovery_codes/utils/security/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5799
5799
|
django_auth_recovery_codes/utils/security/generator.py,sha256=9kT40YddxioylQuOMwbif-RCM-BFrYBBCmZ4tLaP4Fc,4993
|
|
5800
5800
|
django_auth_recovery_codes/utils/security/hash.py,sha256=EFYBdLsUgOHWbTe7MghGDrUxE7oafgDRY2IL4bjKn6Q,2680
|
|
5801
|
-
django_auth_recovery_codes-1.0.
|
|
5802
|
-
django_auth_recovery_codes-1.0.
|
|
5803
|
-
django_auth_recovery_codes-1.0.
|
|
5804
|
-
django_auth_recovery_codes-1.0.
|
|
5805
|
-
django_auth_recovery_codes-1.0.
|
|
5801
|
+
django_auth_recovery_codes-1.0.2.dist-info/licenses/LICENSE,sha256=BvizeN100YXjms404P-KX6Glx35wY3Ak_guK1SCQQuw,1085
|
|
5802
|
+
django_auth_recovery_codes-1.0.2.dist-info/METADATA,sha256=dRJVq1pupArA7OZ7F5rvVQUKOQp0B1a80O7tyI_FjpY,108347
|
|
5803
|
+
django_auth_recovery_codes-1.0.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5804
|
+
django_auth_recovery_codes-1.0.2.dist-info/top_level.txt,sha256=1a1TlG4RcYLPkmy5_Ver6LAuaq1ukelvyhft-KENVKA,27
|
|
5805
|
+
django_auth_recovery_codes-1.0.2.dist-info/RECORD,,
|
{django_auth_recovery_codes-1.0.0.dist-info → django_auth_recovery_codes-1.0.2.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|