prune_captcha 1.18.4__py3-none-any.whl → 1.18.6__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.
prune_captcha/apps.py CHANGED
@@ -11,3 +11,7 @@ class DjangoPuzzleConfig(AppConfig):
11
11
  raise ImproperlyConfigured(
12
12
  "prune_captcha: vous devez définir PUZZLE_IMAGE_STATIC_PATH dans settings.py"
13
13
  )
14
+ if not hasattr(settings, "PUZZLE_HINT_TEXT "):
15
+ raise ImproperlyConfigured(
16
+ "prune_captcha: vous devez définir PUZZLE_HINT_TEXT dans settings.py"
17
+ )
@@ -1,7 +1,7 @@
1
1
  {% load static %}
2
2
 
3
3
  <div class="prune-captcha">
4
- <p class="puzzle-info">Veuillez glisser la pièce au bon emplacement</p>
4
+ <p class="puzzle-info">{{ puzzle.hint_text }}</p>
5
5
  <div class="puzzle-container" style="width: {{ puzzle.width }}px; height: {{ puzzle.height }}px; background-image: url('{% static puzzle.image %}'); background-size: {{ puzzle.width }}px {{ puzzle.height }}px;">
6
6
  <div class="puzzle-background" style="background-image: url('{% static puzzle.image %}'); background-size: {{ puzzle.width }}px {{ puzzle.height }}px;"></div>
7
7
  <div class="puzzle-mask" style="top: {{ puzzle.pos_y_solution }}px; left: {{ puzzle.pos_x_solution }}px; width: {{ puzzle.piece_width }}px; height: {{ puzzle.piece_height }}px;"></div>
prune_captcha/utils.py CHANGED
@@ -34,12 +34,20 @@ def create_and_get_captcha(
34
34
  "piece_pos_x": piece_pos_x,
35
35
  "piece_pos_y": piece_pos_y,
36
36
  "image": f"{puzzle_images_path}{selected_image}",
37
+ "hint_text": settings.PUZZLE_HINT_TEXT,
37
38
  }
38
39
 
39
40
 
40
41
  def verify_captcha(request: HttpRequest) -> bool:
41
- pos_x_answer = int(request.POST.get("pos_x_answer"))
42
- pos_y_answer = int(request.POST.get("pos_y_answer"))
42
+ pos_x_answer_str = request.POST.get("pos_x_answer")
43
+ pos_y_answer_str = request.POST.get("pos_y_answer")
44
+ if pos_x_answer_str is None or pos_y_answer_str is None:
45
+ return False
46
+ try:
47
+ pos_x_answer = int(pos_x_answer_str)
48
+ pos_y_answer = int(pos_y_answer_str)
49
+ except ValueError:
50
+ return False
43
51
  if pos_x_answer is None or pos_y_answer is None:
44
52
  return False
45
53
  puzzle = request.session.get("puzzle")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: prune_captcha
3
- Version: 1.18.4
3
+ Version: 1.18.6
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/
@@ -126,6 +126,8 @@ Important: You must import the static files (css, js) present in "prune_captcha/
126
126
 
127
127
  | Version | Date | Notes |
128
128
  | ------- | ---------- | ---------------------------------- |
129
+ | 1.18.6 | 2025-05-28 | added PUZZLE_HINT_TEXT |
130
+ | 1.18.5 | 2025-05-23 | ValueError fixed |
129
131
  | 1.18.4 | 2025-05-23 | deleted var |
130
132
  | 1.18.3 | 2025-05-22 | add puzzle info |
131
133
  | 1.18.2 | 2025-05-22 | fix |
@@ -0,0 +1,10 @@
1
+ prune_captcha/__init__.py,sha256=289nX-nsT20GUbXE9Lm4Iv6H7b7XmJyLisg9Z2MRR0k,61
2
+ prune_captcha/apps.py,sha256=ZcZuI2_epek32VF1v5ZNPjpmWE4T_45JQ9cNC4byrag,619
3
+ prune_captcha/utils.py,sha256=bj3-aDf2S23gID6V95WuYolXXVeA1oXZCJKHtuoHSVk,2059
4
+ prune_captcha/static/prune_captcha/css/captcha.css,sha256=ntZF_NsNLx_GUeG80oJ8GTDHZ3Le4MjKF9Ur88SSFTA,422
5
+ prune_captcha/static/prune_captcha/js/captcha.js,sha256=qcFESOTV_hCQSNkT6lcl7pkAqMyOyqMoJLldL8f02Kg,2202
6
+ prune_captcha/templates/prune_captcha/captcha.html,sha256=n0U_iFDdm5EOIc6M6Dxl5jhdG18zdJSceT1YIytczks,1105
7
+ prune_captcha-1.18.6.dist-info/METADATA,sha256=kXf97iSZHeJ8wFHrYkNeDhEbd31I99O6Ts66zRy918A,4786
8
+ prune_captcha-1.18.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
9
+ prune_captcha-1.18.6.dist-info/top_level.txt,sha256=v0fVjlwv7OWp7NHgpeR5Oj0xhlf81K24sP2r9DYw5Qg,14
10
+ prune_captcha-1.18.6.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,10 +0,0 @@
1
- prune_captcha/__init__.py,sha256=289nX-nsT20GUbXE9Lm4Iv6H7b7XmJyLisg9Z2MRR0k,61
2
- prune_captcha/apps.py,sha256=imbFju15itWdZA7vPg7IRD0QnDp8FFnrEQVpjha8G7M,422
3
- prune_captcha/utils.py,sha256=2BNV2PIWVAfZH7gcuS-53u74D3vl1x7kG5O18Qjsu0I,1788
4
- prune_captcha/static/prune_captcha/css/captcha.css,sha256=ntZF_NsNLx_GUeG80oJ8GTDHZ3Le4MjKF9Ur88SSFTA,422
5
- prune_captcha/static/prune_captcha/js/captcha.js,sha256=qcFESOTV_hCQSNkT6lcl7pkAqMyOyqMoJLldL8f02Kg,2202
6
- prune_captcha/templates/prune_captcha/captcha.html,sha256=lmi2RolhEHyd3IAvA_ZGsGpo7RLhn-wi3-6tOgwpg4c,1128
7
- prune_captcha-1.18.4.dist-info/METADATA,sha256=I8JD3okNxXf5Fg7iHxzQYfwr_HDe8wg0QBbm_qPndzI,4662
8
- prune_captcha-1.18.4.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
9
- prune_captcha-1.18.4.dist-info/top_level.txt,sha256=v0fVjlwv7OWp7NHgpeR5Oj0xhlf81K24sP2r9DYw5Qg,14
10
- prune_captcha-1.18.4.dist-info/RECORD,,