django-altcha 0.1.0__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.
@@ -0,0 +1,3 @@
1
+ # Ignore all Git auto CR/LF line endings conversions
2
+ * -text
3
+ pyproject.toml export-subst
@@ -0,0 +1,75 @@
1
+ # Python compiled files
2
+ *.py[cod]
3
+
4
+ # virtualenv and other misc bits
5
+ /src/*.egg-info
6
+ *.egg-info
7
+ /dist
8
+ /build
9
+ /bin
10
+ /lib
11
+ /scripts
12
+ /Scripts
13
+ /Lib
14
+ /pip-selfcheck.json
15
+ /tmp
16
+ /venv
17
+ /.venv
18
+ .Python
19
+ /include
20
+ /Include
21
+ /local
22
+ */local/*
23
+ /local/
24
+ /share/
25
+ /tcl/
26
+ /.eggs/
27
+
28
+ # Installer logs
29
+ pip-log.txt
30
+
31
+ # Unit test / coverage reports
32
+ .cache
33
+ .coverage
34
+ .coverage.*
35
+ nosetests.xml
36
+ htmlcov
37
+
38
+ # Translations
39
+ *.mo
40
+
41
+ # IDEs
42
+ .project
43
+ .pydevproject
44
+ .idea
45
+ org.eclipse.core.resources.prefs
46
+ .vscode
47
+ .vs
48
+
49
+ # Sphinx
50
+ docs/_build
51
+ docs/bin
52
+ docs/build
53
+ docs/include
54
+ docs/Lib
55
+ doc/pyvenv.cfg
56
+ pyvenv.cfg
57
+
58
+ # Various junk and temp files
59
+ .DS_Store
60
+ *~
61
+ .*.sw[po]
62
+ .build
63
+ .ve
64
+ *.bak
65
+ /.cache/
66
+
67
+ # pyenv
68
+ /.python-version
69
+ /man/
70
+ /.pytest_cache/
71
+ lib64
72
+ tcl
73
+
74
+ # Ignore Jupyter Notebook related temp files
75
+ .ipynb_checkpoints/
@@ -0,0 +1,29 @@
1
+ # .readthedocs.yml
2
+ # Read the Docs configuration file
3
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4
+
5
+ # Required
6
+ version: 2
7
+
8
+ # Build in latest ubuntu/python
9
+ build:
10
+ os: ubuntu-22.04
11
+ tools:
12
+ python: "3.11"
13
+
14
+ # Build PDF & ePub
15
+ formats:
16
+ - epub
17
+ - pdf
18
+
19
+ # Where the Sphinx conf.py file is located
20
+ sphinx:
21
+ configuration: docs/source/conf.py
22
+
23
+ # Setting the python version and doc build requirements
24
+ python:
25
+ install:
26
+ - method: pip
27
+ path: .
28
+ extra_requirements:
29
+ - docs
@@ -0,0 +1,7 @@
1
+ Changelog
2
+ =========
3
+
4
+ v0.1.0 (2025-03-31)
5
+ -------------------
6
+
7
+ - Initial release.
@@ -0,0 +1,86 @@
1
+ Contributor Covenant Code of Conduct
2
+ ====================================
3
+
4
+ Our Pledge
5
+ ----------
6
+
7
+ In the interest of fostering an open and welcoming environment, we as
8
+ contributors and maintainers pledge to making participation in our
9
+ project and our community a harassment-free experience for everyone,
10
+ regardless of age, body size, disability, ethnicity, gender identity and
11
+ expression, level of experience, education, socio-economic status,
12
+ nationality, personal appearance, race, religion, or sexual identity and
13
+ orientation.
14
+
15
+ Our Standards
16
+ -------------
17
+
18
+ Examples of behavior that contributes to creating a positive environment
19
+ include:
20
+
21
+ - Using welcoming and inclusive language
22
+ - Being respectful of differing viewpoints and experiences
23
+ - Gracefully accepting constructive criticism
24
+ - Focusing on what is best for the community
25
+ - Showing empathy towards other community members
26
+
27
+ Examples of unacceptable behavior by participants include:
28
+
29
+ - The use of sexualized language or imagery and unwelcome sexual
30
+ attention or advances
31
+ - Trolling, insulting/derogatory comments, and personal or political
32
+ attacks
33
+ - Public or private harassment
34
+ - Publishing others’ private information, such as a physical or
35
+ electronic address, without explicit permission
36
+ - Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ Our Responsibilities
40
+ --------------------
41
+
42
+ Project maintainers are responsible for clarifying the standards of
43
+ acceptable behavior and are expected to take appropriate and fair
44
+ corrective action in response to any instances of unacceptable behavior.
45
+
46
+ Project maintainers have the right and responsibility to remove, edit,
47
+ or reject comments, commits, code, wiki edits, issues, and other
48
+ contributions that are not aligned to this Code of Conduct, or to ban
49
+ temporarily or permanently any contributor for other behaviors that they
50
+ deem inappropriate, threatening, offensive, or harmful.
51
+
52
+ Scope
53
+ -----
54
+
55
+ This Code of Conduct applies both within project spaces and in public
56
+ spaces when an individual is representing the project or its community.
57
+ Examples of representing a project or community include using an
58
+ official project e-mail address, posting via an official social media
59
+ account, or acting as an appointed representative at an online or
60
+ offline event. Representation of a project may be further defined and
61
+ clarified by project maintainers.
62
+
63
+ Enforcement
64
+ -----------
65
+
66
+ Instances of abusive, harassing, or otherwise unacceptable behavior may
67
+ be reported by contacting the project team at pombredanne@gmail.com
68
+ or on the Gitter chat channel at https://gitter.im/aboutcode-org/discuss .
69
+ All complaints will be reviewed and investigated and will result in a
70
+ response that is deemed necessary and appropriate to the circumstances.
71
+ The project team is obligated to maintain confidentiality with regard to
72
+ the reporter of an incident. Further details of specific enforcement
73
+ policies may be posted separately.
74
+
75
+ Project maintainers who do not follow or enforce the Code of Conduct in
76
+ good faith may face temporary or permanent repercussions as determined
77
+ by other members of the project’s leadership.
78
+
79
+ Attribution
80
+ -----------
81
+
82
+ This Code of Conduct is adapted from the `Contributor Covenant`_ ,
83
+ version 1.4, available at
84
+ https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
85
+
86
+ .. _Contributor Covenant: https://www.contributor-covenant.org
@@ -0,0 +1,5 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2
+
3
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
4
+
5
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ graft src
2
+
3
+ include LICENSE
4
+ include NOTICE
5
+ include *.ABOUT
6
+ include *.toml
7
+ include *.yml
8
+ include *.rst
9
+ include setup.*
10
+ include requirements*
11
+ include .git*
12
+
13
+ global-exclude *.py[co] __pycache__ *.*~
@@ -0,0 +1,6 @@
1
+ #
2
+ # Copyright (c) nexB Inc. and others. All rights reserved.
3
+ # SPDX-License-Identifier: MIT
4
+ # See https://github.com/aboutcode-org/django-altcha for support or download.
5
+ # See https://aboutcode.org for more information about AboutCode FOSS projects.
6
+ #
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-altcha
3
+ Version: 0.1.0
4
+ Summary: Django field and widget for Altcha CAPTCHA.
5
+ Author-email: "nexB Inc." <info@nexb.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/aboutcode-org/django-altcha
8
+ Project-URL: Documentation, https://django-altcha.readthedocs.io/
9
+ Project-URL: Repository, https://github.com/aboutcode-org/django-altcha.git
10
+ Project-URL: Issues, https://github.com/aboutcode-org/django-altcha/issues
11
+ Project-URL: Changelog, https://github.com/aboutcode-org/django-altcha/blob/main/CHANGELOG.rst
12
+ Keywords: captcha,django,widget,form,altcha
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Environment :: Web Environment
15
+ Classifier: Framework :: Django
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: Django>=4.2
29
+ Requires-Dist: altcha>=0.1.9
30
+ Provides-Extra: dev
31
+ Requires-Dist: build; extra == "dev"
32
+ Requires-Dist: ruff; extra == "dev"
33
+ Provides-Extra: docs
34
+ Requires-Dist: Sphinx>=5.0.2; extra == "docs"
35
+ Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
36
+ Requires-Dist: sphinx-reredirects>=0.1.2; extra == "docs"
37
+ Requires-Dist: doc8>=0.11.2; extra == "docs"
38
+ Requires-Dist: sphinx-autobuild; extra == "docs"
39
+ Requires-Dist: sphinx-rtd-dark-mode>=1.3.0; extra == "docs"
40
+ Requires-Dist: sphinx-copybutton; extra == "docs"
41
+ Dynamic: license-file
42
+
43
+ # Django Altcha
44
+
45
+ **Django Altcha** is a Django library that provides easy integration of Altcha CAPTCHA
46
+ into your Django forms, enhancing user verification with configurable options.
47
+
48
+ By default, CAPTCHA validation operates in a **fully self-hosted mode**,
49
+ **eliminating the need for external services** while ensuring privacy and control over
50
+ the verification process.
51
+
52
+ ## Installation
53
+
54
+ 1. **Install the package:**
55
+
56
+ ```bash
57
+ pip install django-altcha
58
+ ```
59
+
60
+ 2. **Add to `INSTALLED_APPS`:**
61
+
62
+ Update your Django project's `settings.py`:
63
+
64
+ ```python
65
+ INSTALLED_APPS = [
66
+ # Other installed apps
67
+ "django_altcha",
68
+ ]
69
+ ```
70
+
71
+ ## Usage
72
+
73
+ ### Adding the CAPTCHA Field to Your Form
74
+
75
+ To add the Altcha CAPTCHA field to a Django form, import `AltchaField` and add it to
76
+ your form definition:
77
+
78
+ ```python
79
+ from django import forms
80
+ from django_altcha import AltchaField
81
+
82
+ class MyForm(forms.Form):
83
+ captcha = AltchaField()
84
+ ```
85
+
86
+ ## Configuration Options
87
+
88
+ You can pass configuration options to `AltchaField` that are supported by Altcha.
89
+ These options are documented at
90
+ [Altcha's website integration guide](https://altcha.org/docs/website-integration/).
91
+
92
+ ### Example with additional options:
93
+
94
+ ```python
95
+ class MyForm(forms.Form):
96
+ captcha = AltchaField(
97
+ floating=True, # Enables floating behavior
98
+ debug=True, # Enables debug mode (for development)
99
+ # Additional options supported by Altcha
100
+ )
101
+ ```
102
+
103
+ ## Contributing
104
+
105
+ We welcome contributions to improve this library.
106
+ Feel free to submit issues or pull requests!
107
+
108
+ ## License
109
+
110
+ This project is licensed under the **MIT License**.
111
+ See the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,69 @@
1
+ # Django Altcha
2
+
3
+ **Django Altcha** is a Django library that provides easy integration of Altcha CAPTCHA
4
+ into your Django forms, enhancing user verification with configurable options.
5
+
6
+ By default, CAPTCHA validation operates in a **fully self-hosted mode**,
7
+ **eliminating the need for external services** while ensuring privacy and control over
8
+ the verification process.
9
+
10
+ ## Installation
11
+
12
+ 1. **Install the package:**
13
+
14
+ ```bash
15
+ pip install django-altcha
16
+ ```
17
+
18
+ 2. **Add to `INSTALLED_APPS`:**
19
+
20
+ Update your Django project's `settings.py`:
21
+
22
+ ```python
23
+ INSTALLED_APPS = [
24
+ # Other installed apps
25
+ "django_altcha",
26
+ ]
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### Adding the CAPTCHA Field to Your Form
32
+
33
+ To add the Altcha CAPTCHA field to a Django form, import `AltchaField` and add it to
34
+ your form definition:
35
+
36
+ ```python
37
+ from django import forms
38
+ from django_altcha import AltchaField
39
+
40
+ class MyForm(forms.Form):
41
+ captcha = AltchaField()
42
+ ```
43
+
44
+ ## Configuration Options
45
+
46
+ You can pass configuration options to `AltchaField` that are supported by Altcha.
47
+ These options are documented at
48
+ [Altcha's website integration guide](https://altcha.org/docs/website-integration/).
49
+
50
+ ### Example with additional options:
51
+
52
+ ```python
53
+ class MyForm(forms.Form):
54
+ captcha = AltchaField(
55
+ floating=True, # Enables floating behavior
56
+ debug=True, # Enables debug mode (for development)
57
+ # Additional options supported by Altcha
58
+ )
59
+ ```
60
+
61
+ ## Contributing
62
+
63
+ We welcome contributions to improve this library.
64
+ Feel free to submit issues or pull requests!
65
+
66
+ ## License
67
+
68
+ This project is licensed under the **MIT License**.
69
+ See the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,148 @@
1
+ #
2
+ # Copyright (c) nexB Inc. and others. All rights reserved.
3
+ # SPDX-License-Identifier: MIT
4
+ # See https://github.com/aboutcode-org/django-altcha for support or download.
5
+ # See https://aboutcode.org for more information about AboutCode FOSS projects.
6
+ #
7
+
8
+ import json
9
+ import secrets
10
+
11
+ import altcha
12
+ from django import forms
13
+ from django.conf import settings
14
+ from django.forms.widgets import HiddenInput
15
+ from django.utils.translation import gettext_lazy as _
16
+
17
+ __version__ = "0.1.0"
18
+ VERSION = __version__
19
+
20
+ # Get the ALTCHA_HMAC_KEY from the settings, or generate one if not present.
21
+ ALTCHA_HMAC_KEY = getattr(settings, "ALTCHA_HMAC_KEY", secrets.token_hex(32))
22
+ ALTCHA_JS_URL = getattr(settings, "ALTCHA_JS_URL", "/static/altcha/altcha.min.js")
23
+
24
+
25
+ def get_altcha_challenge():
26
+ """Generate and return an ALTCHA challenge."""
27
+ challenge = altcha.create_challenge(
28
+ altcha.ChallengeOptions(
29
+ hmac_key=ALTCHA_HMAC_KEY,
30
+ max_number=50000,
31
+ )
32
+ )
33
+ return challenge
34
+
35
+
36
+ class AltchaWidget(HiddenInput):
37
+ template_name = "altcha_widget.html"
38
+
39
+ def __init__(self, options, *args, **kwargs):
40
+ """Initialize the ALTCHA widget with provided options from the field."""
41
+ self.options = options
42
+ super().__init__(*args, **kwargs)
43
+
44
+ def get_context(self, name, value, attrs):
45
+ """Generate the widget context, including ALTCHA JS URL and challenge."""
46
+ context = super().get_context(name, value, attrs)
47
+ context["js_src_url"] = ALTCHA_JS_URL
48
+
49
+ # If a `challengeurl` is provided, the challenge will be fetched from this URL.
50
+ # This can be a local Django view or an external API endpoint.
51
+ # If not provided, a unique challenge is generated locally in a self-hosted
52
+ # mode.
53
+ # Since the challenge must be fresh for each form rendering, it is generated
54
+ # inside `get_context`, not `__init__`.
55
+ if not self.options.get("challengeurl"):
56
+ challenge = get_altcha_challenge()
57
+ self.options["challengejson"] = json.dumps(challenge.__dict__)
58
+
59
+ context["widget"]["altcha_options"] = self.options
60
+ return context
61
+
62
+
63
+ class AltchaField(forms.Field):
64
+ widget = AltchaWidget
65
+ default_error_messages = {
66
+ "error": _("Failed to process CAPTCHA token"),
67
+ "invalid": _("Invalid CAPTCHA token."),
68
+ "required": _("ALTCHA CAPTCHA token is missing."),
69
+ }
70
+ default_options = {
71
+ # URL of your server to fetch the challenge from.
72
+ "challengeurl": None,
73
+ # JSON-encoded challenge data
74
+ # (use instead of challengeurl to avoid HTTP request).
75
+ "challengejson": None,
76
+ # Automatically verify without user interaction.
77
+ # Possible values: "off", "onfocus", "onload", "onsubmit".
78
+ "auto": None,
79
+ # Artificial delay before verification (in milliseconds, default: 0).
80
+ "delay": None,
81
+ # Challenge expiration duration (in milliseconds).
82
+ "expire": None,
83
+ # Enable floating UI.
84
+ # Possible values: "auto", "top", "bottom".
85
+ "floating": None,
86
+ # CSS selector of the “anchor” to which the floating UI is attached.
87
+ # Default: submit button in the related form.
88
+ "floatinganchor": None,
89
+ # Y offset from the anchor element for the floating UI (in pixels, default: 12).
90
+ "floatingoffset": None,
91
+ # Enable a “persistent” mode to keep the widget visible under specific
92
+ # conditions.
93
+ # Possible values: "true", "focus".
94
+ "floatingpersist": None,
95
+ # Hide the footer (ALTCHA link).
96
+ "hidefooter": None,
97
+ # Hide the ALTCHA logo.
98
+ "hidelogo": None,
99
+ # Max number to iterate to (default: 1,000,000).
100
+ "maxnumber": None,
101
+ # JSON-encoded translation strings for customization.
102
+ "strings": None,
103
+ # Automatically re-fetch and re-validate when the challenge expires
104
+ # (default: true).
105
+ "refetchonexpire": None,
106
+ # Number of workers for Proof of Work (PoW).
107
+ # Default: navigator.hardwareConcurrency or 8 (max value: 16).
108
+ "workers": None,
109
+ # URL of the Worker script (default: ./worker.js, only for external builds).
110
+ "workerurl": None,
111
+ # Print log messages in the console (for debugging).
112
+ "debug": None,
113
+ # Causes verification to always fail with a "mock" error.
114
+ "mockerror": None,
115
+ # Generates a “mock” challenge within the widget, bypassing the request to
116
+ # challengeurl.
117
+ "test": None,
118
+ }
119
+
120
+ def __init__(self, *args, **kwargs):
121
+ """Initialize the ALTCHA field and pass widget options for rendering."""
122
+ widget_options = {
123
+ key: kwargs.pop(key, self.default_options[key])
124
+ for key in self.default_options
125
+ }
126
+ kwargs["widget"] = self.widget(options=widget_options)
127
+ super().__init__(*args, **kwargs)
128
+
129
+ def validate(self, value):
130
+ """Validate the CAPTCHA token and verify its authenticity."""
131
+ super().validate(value)
132
+
133
+ if not value:
134
+ raise forms.ValidationError(
135
+ self.error_messages["required"], code="required"
136
+ )
137
+
138
+ try:
139
+ verified, error = altcha.verify_solution(
140
+ payload=value,
141
+ hmac_key=ALTCHA_HMAC_KEY,
142
+ check_expires=False,
143
+ )
144
+ except Exception:
145
+ raise forms.ValidationError(self.error_messages["error"], code="error")
146
+
147
+ if not verified:
148
+ raise forms.ValidationError(self.error_messages["invalid"], code="invalid")
@@ -0,0 +1,111 @@
1
+ Metadata-Version: 2.4
2
+ Name: django-altcha
3
+ Version: 0.1.0
4
+ Summary: Django field and widget for Altcha CAPTCHA.
5
+ Author-email: "nexB Inc." <info@nexb.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/aboutcode-org/django-altcha
8
+ Project-URL: Documentation, https://django-altcha.readthedocs.io/
9
+ Project-URL: Repository, https://github.com/aboutcode-org/django-altcha.git
10
+ Project-URL: Issues, https://github.com/aboutcode-org/django-altcha/issues
11
+ Project-URL: Changelog, https://github.com/aboutcode-org/django-altcha/blob/main/CHANGELOG.rst
12
+ Keywords: captcha,django,widget,form,altcha
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Environment :: Web Environment
15
+ Classifier: Framework :: Django
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Programming Language :: Python
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: Django>=4.2
29
+ Requires-Dist: altcha>=0.1.9
30
+ Provides-Extra: dev
31
+ Requires-Dist: build; extra == "dev"
32
+ Requires-Dist: ruff; extra == "dev"
33
+ Provides-Extra: docs
34
+ Requires-Dist: Sphinx>=5.0.2; extra == "docs"
35
+ Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
36
+ Requires-Dist: sphinx-reredirects>=0.1.2; extra == "docs"
37
+ Requires-Dist: doc8>=0.11.2; extra == "docs"
38
+ Requires-Dist: sphinx-autobuild; extra == "docs"
39
+ Requires-Dist: sphinx-rtd-dark-mode>=1.3.0; extra == "docs"
40
+ Requires-Dist: sphinx-copybutton; extra == "docs"
41
+ Dynamic: license-file
42
+
43
+ # Django Altcha
44
+
45
+ **Django Altcha** is a Django library that provides easy integration of Altcha CAPTCHA
46
+ into your Django forms, enhancing user verification with configurable options.
47
+
48
+ By default, CAPTCHA validation operates in a **fully self-hosted mode**,
49
+ **eliminating the need for external services** while ensuring privacy and control over
50
+ the verification process.
51
+
52
+ ## Installation
53
+
54
+ 1. **Install the package:**
55
+
56
+ ```bash
57
+ pip install django-altcha
58
+ ```
59
+
60
+ 2. **Add to `INSTALLED_APPS`:**
61
+
62
+ Update your Django project's `settings.py`:
63
+
64
+ ```python
65
+ INSTALLED_APPS = [
66
+ # Other installed apps
67
+ "django_altcha",
68
+ ]
69
+ ```
70
+
71
+ ## Usage
72
+
73
+ ### Adding the CAPTCHA Field to Your Form
74
+
75
+ To add the Altcha CAPTCHA field to a Django form, import `AltchaField` and add it to
76
+ your form definition:
77
+
78
+ ```python
79
+ from django import forms
80
+ from django_altcha import AltchaField
81
+
82
+ class MyForm(forms.Form):
83
+ captcha = AltchaField()
84
+ ```
85
+
86
+ ## Configuration Options
87
+
88
+ You can pass configuration options to `AltchaField` that are supported by Altcha.
89
+ These options are documented at
90
+ [Altcha's website integration guide](https://altcha.org/docs/website-integration/).
91
+
92
+ ### Example with additional options:
93
+
94
+ ```python
95
+ class MyForm(forms.Form):
96
+ captcha = AltchaField(
97
+ floating=True, # Enables floating behavior
98
+ debug=True, # Enables debug mode (for development)
99
+ # Additional options supported by Altcha
100
+ )
101
+ ```
102
+
103
+ ## Contributing
104
+
105
+ We welcome contributions to improve this library.
106
+ Feel free to submit issues or pull requests!
107
+
108
+ ## License
109
+
110
+ This project is licensed under the **MIT License**.
111
+ See the [LICENSE](./LICENSE) file for details.
@@ -0,0 +1,16 @@
1
+ .gitattributes
2
+ .gitignore
3
+ .readthedocs.yml
4
+ CHANGELOG.rst
5
+ CODE_OF_CONDUCT.rst
6
+ LICENSE
7
+ MANIFEST.in
8
+ NOTICE
9
+ README.md
10
+ pyproject.toml
11
+ django_altcha/__init__.py
12
+ django_altcha.egg-info/PKG-INFO
13
+ django_altcha.egg-info/SOURCES.txt
14
+ django_altcha.egg-info/dependency_links.txt
15
+ django_altcha.egg-info/requires.txt
16
+ django_altcha.egg-info/top_level.txt
@@ -0,0 +1,15 @@
1
+ Django>=4.2
2
+ altcha>=0.1.9
3
+
4
+ [dev]
5
+ build
6
+ ruff
7
+
8
+ [docs]
9
+ Sphinx>=5.0.2
10
+ sphinx-rtd-theme>=1.0.0
11
+ sphinx-reredirects>=0.1.2
12
+ doc8>=0.11.2
13
+ sphinx-autobuild
14
+ sphinx-rtd-dark-mode>=1.3.0
15
+ sphinx-copybutton
@@ -0,0 +1 @@
1
+ django_altcha
@@ -0,0 +1,73 @@
1
+ [build-system]
2
+ requires = ["setuptools >= 61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "django-altcha"
7
+ version = "0.1.0"
8
+ description = "Django field and widget for Altcha CAPTCHA."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [
13
+ { name = "nexB Inc.", email = "info@nexb.com" }
14
+ ]
15
+ classifiers = [
16
+ "Development Status :: 5 - Production/Stable",
17
+ "Environment :: Web Environment",
18
+ "Framework :: Django",
19
+ "Intended Audience :: Developers",
20
+ "Programming Language :: Python",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ ]
29
+ requires-python = ">=3.9"
30
+ dependencies = [
31
+ "Django>=4.2",
32
+ "altcha>=0.1.9",
33
+ ]
34
+ keywords = ["captcha", "django", "widget", "form", "altcha"]
35
+
36
+ [project.optional-dependencies]
37
+ dev = [
38
+ "build",
39
+ "ruff",
40
+ ]
41
+ docs = [
42
+ "Sphinx>=5.0.2",
43
+ "sphinx-rtd-theme>=1.0.0",
44
+ "sphinx-reredirects >= 0.1.2",
45
+ "doc8>=0.11.2",
46
+ "sphinx-autobuild",
47
+ "sphinx-rtd-dark-mode>=1.3.0",
48
+ "sphinx-copybutton",
49
+ ]
50
+
51
+ [project.urls]
52
+ Homepage = "https://github.com/aboutcode-org/django-altcha"
53
+ Documentation = "https://django-altcha.readthedocs.io/"
54
+ Repository = "https://github.com/aboutcode-org/django-altcha.git"
55
+ Issues = "https://github.com/aboutcode-org/django-altcha/issues"
56
+ Changelog = "https://github.com/aboutcode-org/django-altcha/blob/main/CHANGELOG.rst"
57
+
58
+ [tool.ruff]
59
+ exclude = [
60
+ "docs",
61
+ ]
62
+
63
+ [tool.ruff.lint]
64
+ # Rules: https://docs.astral.sh/ruff/rules/
65
+ select = [
66
+ "E", # pycodestyle
67
+ "W", # pycodestyle warnings
68
+ "F", # Pyflakes
69
+ "UP", # pyupgrade
70
+ "S", # flake8-bandit
71
+ "I", # isort
72
+ "C9", # McCabe complexity
73
+ ]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+