django-powcaptcha 0.0.2__py3-none-any.whl → 0.0.4__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.
- django_powcaptcha/client.py +11 -5
- django_powcaptcha/templates/django_powcaptcha/widget.html +1 -1
- {django_powcaptcha-0.0.2.dist-info → django_powcaptcha-0.0.4.dist-info}/METADATA +14 -2
- django_powcaptcha-0.0.4.dist-info/RECORD +12 -0
- {django_powcaptcha-0.0.2.dist-info → django_powcaptcha-0.0.4.dist-info}/WHEEL +1 -1
- django_powcaptcha-0.0.2.dist-info/RECORD +0 -12
- {django_powcaptcha-0.0.2.dist-info → django_powcaptcha-0.0.4.dist-info/licenses}/LICENSE +0 -0
- {django_powcaptcha-0.0.2.dist-info → django_powcaptcha-0.0.4.dist-info}/top_level.txt +0 -0
django_powcaptcha/client.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from django.core.cache import cache
|
|
1
2
|
import json
|
|
2
3
|
from urllib.error import HTTPError
|
|
3
4
|
from urllib.request import Request, build_opener
|
|
@@ -31,13 +32,18 @@ def powcaptcha_request(path, params):
|
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
def get_challenge():
|
|
34
|
-
|
|
35
|
-
response = powcaptcha_request(path, [])
|
|
36
|
-
challenges = json.loads(response.read().decode('utf-8'))
|
|
35
|
+
challenges = cache.get('powcaptcha_challenges')
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
if not challenges or len(challenges) == 0:
|
|
38
|
+
path = 'GetChallenges?difficultyLevel=5'
|
|
39
|
+
response = powcaptcha_request(path, [])
|
|
40
|
+
challenges = json.loads(response.read().decode('utf-8'))
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
challenge = challenges[0]
|
|
43
|
+
challenges.pop(0)
|
|
44
|
+
cache.set('powcaptcha_challenges', challenges, 3600)
|
|
45
|
+
|
|
46
|
+
return challenge
|
|
41
47
|
|
|
42
48
|
|
|
43
49
|
def validate_captcha(challenge: str, nonce: str):
|
|
@@ -15,7 +15,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
window.myCaptchaCallback = (nonce) => {
|
|
18
|
-
Array.from(document.querySelectorAll("input[name
|
|
18
|
+
Array.from(document.querySelectorAll("input[name$='powcaptcha_nonce']")).forEach(e => e.value = nonce);
|
|
19
19
|
Array.from(document.querySelectorAll("input[type='submit']")).forEach(e => e.disabled = false);
|
|
20
20
|
Array.from(document.querySelectorAll("button[type='submit']")).forEach(e => e.disabled = false);
|
|
21
21
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: django-powcaptcha
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Django PowCaptcha form field/widget app.
|
|
5
5
|
Home-page: https://github.com/aeyoll/django-powcaptcha
|
|
6
6
|
Author: Jean-Philippe Bidegain
|
|
@@ -26,6 +26,18 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
26
26
|
Description-Content-Type: text/markdown
|
|
27
27
|
License-File: LICENSE
|
|
28
28
|
Requires-Dist: django
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: author-email
|
|
31
|
+
Dynamic: classifier
|
|
32
|
+
Dynamic: description
|
|
33
|
+
Dynamic: description-content-type
|
|
34
|
+
Dynamic: home-page
|
|
35
|
+
Dynamic: keywords
|
|
36
|
+
Dynamic: license
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
Dynamic: project-url
|
|
39
|
+
Dynamic: requires-dist
|
|
40
|
+
Dynamic: summary
|
|
29
41
|
|
|
30
42
|
# Django PowCaptcha
|
|
31
43
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
django_powcaptcha/__init__.py,sha256=KQ6rfGAMJvwKobMVAn2s_EsL5JpPoMkzoNZg4mT_esk,597
|
|
2
|
+
django_powcaptcha/apps.py,sha256=ShxcNSD7Dl2bnnzb6DCnJ4UcsxxVbXlmCGf9aFKUVz4,146
|
|
3
|
+
django_powcaptcha/client.py,sha256=AWYE82MUR-DLK7gtGx5Q-MZ4VTBQoMeRt_fr3SdCt_s,1334
|
|
4
|
+
django_powcaptcha/fields.py,sha256=4Kx9RN-oCsoBVzYdenM73UgZqvqo6pISh17mIAMB7rs,200
|
|
5
|
+
django_powcaptcha/forms.py,sha256=gcTDVPdmyXGvkwQjR63wbczF9-nQKWlwsM_WsFWbe8Y,735
|
|
6
|
+
django_powcaptcha/widgets.py,sha256=SqGcmraMRQdbzVav5Hm3CF-6KdA-wiEZI_B0tXayEOk,609
|
|
7
|
+
django_powcaptcha/templates/django_powcaptcha/widget.html,sha256=DqHrtLBQm13RGcj-ll7VhJs-q-okdcorv50JNxYU72c,948
|
|
8
|
+
django_powcaptcha-0.0.4.dist-info/licenses/LICENSE,sha256=EaUvjNHHdVXQTD7w9zcrkLZbRcLEnQ6Q0IekrbN3QUg,1509
|
|
9
|
+
django_powcaptcha-0.0.4.dist-info/METADATA,sha256=Ds8k9WuVcjhZqK-Rsbc-HozXNTGarHV2U24TMfbjuvs,2096
|
|
10
|
+
django_powcaptcha-0.0.4.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
11
|
+
django_powcaptcha-0.0.4.dist-info/top_level.txt,sha256=aEMCJ3_ll_timVB-47n6gL3LGDhHHPkdkv3lnvaJBNQ,18
|
|
12
|
+
django_powcaptcha-0.0.4.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
django_powcaptcha/__init__.py,sha256=KQ6rfGAMJvwKobMVAn2s_EsL5JpPoMkzoNZg4mT_esk,597
|
|
2
|
-
django_powcaptcha/apps.py,sha256=ShxcNSD7Dl2bnnzb6DCnJ4UcsxxVbXlmCGf9aFKUVz4,146
|
|
3
|
-
django_powcaptcha/client.py,sha256=spfhklRyVsGXMeh3x0-2XPw80CuP6a0s6I1CP1iRiaE,1112
|
|
4
|
-
django_powcaptcha/fields.py,sha256=4Kx9RN-oCsoBVzYdenM73UgZqvqo6pISh17mIAMB7rs,200
|
|
5
|
-
django_powcaptcha/forms.py,sha256=gcTDVPdmyXGvkwQjR63wbczF9-nQKWlwsM_WsFWbe8Y,735
|
|
6
|
-
django_powcaptcha/widgets.py,sha256=SqGcmraMRQdbzVav5Hm3CF-6KdA-wiEZI_B0tXayEOk,609
|
|
7
|
-
django_powcaptcha/templates/django_powcaptcha/widget.html,sha256=9H_c66_0kid6qxHhNw-3e3M454hpF9wzJT65QU4hRNs,947
|
|
8
|
-
django_powcaptcha-0.0.2.dist-info/LICENSE,sha256=EaUvjNHHdVXQTD7w9zcrkLZbRcLEnQ6Q0IekrbN3QUg,1509
|
|
9
|
-
django_powcaptcha-0.0.2.dist-info/METADATA,sha256=jnF6HKGtV6ZzXsnXZ1fhxxKI5J4aQTsHiGSuNOv1GXI,1846
|
|
10
|
-
django_powcaptcha-0.0.2.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
|
11
|
-
django_powcaptcha-0.0.2.dist-info/top_level.txt,sha256=aEMCJ3_ll_timVB-47n6gL3LGDhHHPkdkv3lnvaJBNQ,18
|
|
12
|
-
django_powcaptcha-0.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|