Skip to content

Commit 3d7dea0

Browse files
committed
Upgrade the Altcha JS lib to latest version 1.4.0 #235
Signed-off-by: tdruez <[email protected]>
1 parent f873c76 commit 3d7dea0

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

dejacode/static/css/dejacode_bootstrap.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -741,11 +741,6 @@ body.signup-form h1 {
741741
body.signup-form .asteriskField {
742742
display: none;
743743
}
744-
body.signup-form .hcaptchawidget {
745-
height:85px !important;
746-
border:0;
747-
text-align:center;
748-
}
749744

750745
/* -- Cards -- */
751746
.card-border-color {

django_altcha/__init__.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from django.forms.widgets import HiddenInput
1414
from django.utils.translation import gettext_lazy as _
1515

16-
# TODO: Add as a dependency
16+
# TODO: Add as a dependency (add a setup.py)
1717
import altcha
1818

1919
"""
@@ -31,8 +31,7 @@
3131
class Form(forms.Form):
3232
captcha = AltchaField()
3333
34-
35-
You can provide any configuration options available at
34+
3. Configure: You can provide any configuration options available at
3635
https://altcha.org/docs/website-integration/ such as:
3736
3837
class Form(forms.Form):
@@ -45,6 +44,7 @@ class Form(forms.Form):
4544

4645
# Get the ALTCHA_HMAC_KEY from the settings, or generate one if not present
4746
ALTCHA_HMAC_KEY = getattr(settings, "ALTCHA_HMAC_KEY", secrets.token_hex(32))
47+
ALTCHA_JS_URL = getattr(settings, "ALTCHA_JS_URL", "/static/altcha/altcha.min.js")
4848

4949

5050
def get_altcha_challenge():
@@ -81,6 +81,9 @@ class AltchaWidget(HiddenInput):
8181
"floatinganchor": None,
8282
# Y offset from the anchor element for the floating UI (in pixels, default: 12).
8383
"floatingoffset": None,
84+
# Enable a “persistent” mode to keep the widget visible under specific conditions.
85+
# Possible values: "true", "focus".
86+
"floatingpersist": None,
8487
# Hide the footer (ALTCHA link).
8588
"hidefooter": None,
8689
# Hide the ALTCHA logo.
@@ -109,7 +112,7 @@ class AltchaWidget(HiddenInput):
109112
def __init__(self, **kwargs):
110113
"""Initialize the ALTCHA widget with configurable options."""
111114
super().__init__()
112-
self.js_src_url = "/static/altcha/altcha.min.js"
115+
self.js_src_url = ALTCHA_JS_URL
113116
self.options = {
114117
key: kwargs.get(key, self.default_options[key]) for key in self.default_options
115118
}

django_altcha/static/altcha/altcha.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
about_resource: altcha.min.js
22
name: altcha
3-
version: 1.3.0
4-
download_url: https://cdn.jsdelivr.net/gh/altcha-org/altcha@main/dist/altcha.min.js
5-
package_url: pkg:github/altcha-org/altcha@1.3.0
3+
version: 1.4.0
4+
download_url: https://cdn.jsdelivr.net/gh/altcha-org/altcha@1.4.0/dist/altcha.min.js
5+
package_url: pkg:github/altcha-org/altcha@1.4.0
66
license_expression: mit
77
copyright: Copyright (c) 2023 Daniel Regeci

dje/registration.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ class DejaCodeRegistrationForm(RegistrationFormUniqueEmail):
8888

8989
use_required_attribute = True
9090
captcha = AltchaField(
91-
# strings={"label": "I'm not a robot"},
9291
floating=True,
9392
hidefooter=True,
9493
)

0 commit comments

Comments
 (0)