prune_captcha 1.17.0__tar.gz → 1.18.1__tar.gz
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.
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/PKG-INFO +13 -1
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/README.md +12 -0
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha/static/prune_captcha/js/captcha.js +19 -4
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha/utils.py +8 -8
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha.egg-info/PKG-INFO +13 -1
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/pyproject.toml +1 -1
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/MANIFEST.in +0 -0
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha/__init__.py +0 -0
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha/apps.py +0 -0
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha/static/prune_captcha/css/captcha.css +0 -0
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha/templates/prune_captcha/captcha.html +0 -0
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha.egg-info/SOURCES.txt +0 -0
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha.egg-info/dependency_links.txt +0 -0
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha.egg-info/requires.txt +0 -0
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha.egg-info/top_level.txt +0 -0
- {prune_captcha-1.17.0 → prune_captcha-1.18.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: prune_captcha
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.18.1
|
4
4
|
Summary: A tool to protect formulaire from spam.
|
5
5
|
Author-email: Arnout <bastien@prune.sh>
|
6
6
|
Project-URL: Made_by, https://prune.sh/
|
@@ -66,6 +66,16 @@ PUZZLE_IMAGE_STATIC_PATH = "website/static/website/images/puzzles/"
|
|
66
66
|
|
67
67
|
Important: You must import the static files (css, js) present in "prune_captcha/static/".
|
68
68
|
|
69
|
+
```html
|
70
|
+
<header>
|
71
|
+
<link
|
72
|
+
rel="stylesheet"
|
73
|
+
href="{% static 'prune_captcha/css/captcha.css' %}"
|
74
|
+
/>
|
75
|
+
<script defer src="{% static 'prune_captcha/js/captcha.js' %}"></script>
|
76
|
+
</header>
|
77
|
+
```
|
78
|
+
|
69
79
|
### Utilisation
|
70
80
|
|
71
81
|
- GET request (form display)
|
@@ -116,6 +126,8 @@ Important: You must import the static files (css, js) present in "prune_captcha/
|
|
116
126
|
|
117
127
|
| Version | Date | Notes |
|
118
128
|
| ------- | ---------- | ---------------------------------- |
|
129
|
+
| 1.18.1 | 2025-05-22 | some improvements |
|
130
|
+
| 1.18.0 | 2025-05-22 | create "addHiddenInputs" func |
|
119
131
|
| 1.17.0 | 2025-05-21 | fix pos_answer |
|
120
132
|
| 1.16.1 | 2025-05-21 | fix static |
|
121
133
|
| 1.16.0 | 2025-05-21 | fix static |
|
@@ -48,6 +48,16 @@ PUZZLE_IMAGE_STATIC_PATH = "website/static/website/images/puzzles/"
|
|
48
48
|
|
49
49
|
Important: You must import the static files (css, js) present in "prune_captcha/static/".
|
50
50
|
|
51
|
+
```html
|
52
|
+
<header>
|
53
|
+
<link
|
54
|
+
rel="stylesheet"
|
55
|
+
href="{% static 'prune_captcha/css/captcha.css' %}"
|
56
|
+
/>
|
57
|
+
<script defer src="{% static 'prune_captcha/js/captcha.js' %}"></script>
|
58
|
+
</header>
|
59
|
+
```
|
60
|
+
|
51
61
|
### Utilisation
|
52
62
|
|
53
63
|
- GET request (form display)
|
@@ -98,6 +108,8 @@ Important: You must import the static files (css, js) present in "prune_captcha/
|
|
98
108
|
|
99
109
|
| Version | Date | Notes |
|
100
110
|
| ------- | ---------- | ---------------------------------- |
|
111
|
+
| 1.18.1 | 2025-05-22 | some improvements |
|
112
|
+
| 1.18.0 | 2025-05-22 | create "addHiddenInputs" func |
|
101
113
|
| 1.17.0 | 2025-05-21 | fix pos_answer |
|
102
114
|
| 1.16.1 | 2025-05-21 | fix static |
|
103
115
|
| 1.16.0 | 2025-05-21 | fix static |
|
{prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha/static/prune_captcha/js/captcha.js
RENAMED
@@ -1,10 +1,25 @@
|
|
1
1
|
const puzzlePiece = document.querySelector(".puzzle-piece");
|
2
2
|
const puzzleContainer = document.querySelector(".puzzle-container");
|
3
|
-
const inputPosX = document.querySelector('input[name="pos_x_answer"]');
|
4
|
-
const inputPosY = document.querySelector('input[name="pos_y_answer"]');
|
5
3
|
|
6
|
-
|
7
|
-
|
4
|
+
const addHiddenInputs = () => {
|
5
|
+
const form = document.querySelector("form");
|
6
|
+
|
7
|
+
["pos_x_answer", "pos_y_answer"].forEach((name) => {
|
8
|
+
const input = document.createElement("input");
|
9
|
+
input.type = "text";
|
10
|
+
input.name = name;
|
11
|
+
input.id = `puzzle_${name}`;
|
12
|
+
input.placeholder = name
|
13
|
+
.replace(/_/g, " ")
|
14
|
+
.replace(/\b\w/g, (c) => c.toUpperCase());
|
15
|
+
input.style.display = "none";
|
16
|
+
form.appendChild(input);
|
17
|
+
});
|
18
|
+
};
|
19
|
+
addHiddenInputs();
|
20
|
+
|
21
|
+
const inputPosX = document.querySelector('input[id="puzzle_pos_x_answer"]');
|
22
|
+
const inputPosY = document.querySelector('input[id="puzzle_pos_y_answer"]');
|
8
23
|
|
9
24
|
let isDragging = false;
|
10
25
|
let offsetX = 0;
|
@@ -19,9 +19,11 @@ def create_and_get_captcha(
|
|
19
19
|
if f.lower().endswith((".jpg", ".jpeg", ".png", ".gif", ".webp"))
|
20
20
|
]
|
21
21
|
selected_image = random.choice(puzzle_images)
|
22
|
-
request.session["
|
23
|
-
|
24
|
-
|
22
|
+
request.session["puzzle"] = {
|
23
|
+
"pos_x_solution": pos_x_solution,
|
24
|
+
"pos_y_solution": pos_y_solution,
|
25
|
+
"precision": precision,
|
26
|
+
}
|
25
27
|
return {
|
26
28
|
"width": width,
|
27
29
|
"height": height,
|
@@ -40,12 +42,10 @@ def verify_captcha(request: HttpRequest) -> bool:
|
|
40
42
|
pos_y_answer = int(request.POST.get("pos_y_answer"))
|
41
43
|
if pos_x_answer is None or pos_y_answer is None:
|
42
44
|
return False
|
43
|
-
|
44
|
-
pos_y_solution = request.session.get("pos_y_solution")
|
45
|
-
precision = request.session.get("precision")
|
45
|
+
puzzle = request.session.get("puzzle")
|
46
46
|
if (
|
47
|
-
abs(pos_x_solution - pos_x_answer) <= precision
|
48
|
-
and abs(pos_y_solution - pos_y_answer) <= precision
|
47
|
+
abs(puzzle.pos_x_solution - pos_x_answer) <= puzzle.precision
|
48
|
+
and abs(puzzle.pos_y_solution - pos_y_answer) <= puzzle.precision
|
49
49
|
):
|
50
50
|
return True
|
51
51
|
else:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: prune_captcha
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.18.1
|
4
4
|
Summary: A tool to protect formulaire from spam.
|
5
5
|
Author-email: Arnout <bastien@prune.sh>
|
6
6
|
Project-URL: Made_by, https://prune.sh/
|
@@ -66,6 +66,16 @@ PUZZLE_IMAGE_STATIC_PATH = "website/static/website/images/puzzles/"
|
|
66
66
|
|
67
67
|
Important: You must import the static files (css, js) present in "prune_captcha/static/".
|
68
68
|
|
69
|
+
```html
|
70
|
+
<header>
|
71
|
+
<link
|
72
|
+
rel="stylesheet"
|
73
|
+
href="{% static 'prune_captcha/css/captcha.css' %}"
|
74
|
+
/>
|
75
|
+
<script defer src="{% static 'prune_captcha/js/captcha.js' %}"></script>
|
76
|
+
</header>
|
77
|
+
```
|
78
|
+
|
69
79
|
### Utilisation
|
70
80
|
|
71
81
|
- GET request (form display)
|
@@ -116,6 +126,8 @@ Important: You must import the static files (css, js) present in "prune_captcha/
|
|
116
126
|
|
117
127
|
| Version | Date | Notes |
|
118
128
|
| ------- | ---------- | ---------------------------------- |
|
129
|
+
| 1.18.1 | 2025-05-22 | some improvements |
|
130
|
+
| 1.18.0 | 2025-05-22 | create "addHiddenInputs" func |
|
119
131
|
| 1.17.0 | 2025-05-21 | fix pos_answer |
|
120
132
|
| 1.16.1 | 2025-05-21 | fix static |
|
121
133
|
| 1.16.0 | 2025-05-21 | fix static |
|
@@ -26,7 +26,7 @@ classifiers = [
|
|
26
26
|
keywords = ["captcha", "django", "code-quality"]
|
27
27
|
urls = {Made_by = "https://prune.sh/"}
|
28
28
|
name = "prune_captcha"
|
29
|
-
version = "1.
|
29
|
+
version = "1.18.1"
|
30
30
|
description = "A tool to protect formulaire from spam."
|
31
31
|
readme = "README.md"
|
32
32
|
dependencies = [
|
File without changes
|
File without changes
|
File without changes
|
{prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha/static/prune_captcha/css/captcha.css
RENAMED
File without changes
|
{prune_captcha-1.17.0 → prune_captcha-1.18.1}/prune_captcha/templates/prune_captcha/captcha.html
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|