{ "info": { "author": "Travis Veazey", "author_email": "travisvz@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Framework :: Django", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Framework :: Django :: 2.2", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only" ], "description": "django-simplecaptcha\n====================\n\nA textual captcha for Django using simple decorator syntax.\n\nSo What Does it DO?\n-------------------\n\nsimplecaptcha provides an easy decorator syntax to add a textual captcha\nto your Django forms. The captcha is a simple arithmetic question:\nEither add, subtract, or multiply two numbers between 1 and 10. No\nserver-side context is needed, as the captcha uses cryptographic\nsignatures to securely pass the context to the client, and then validate\nthe supplied answer on the back end.\n\nIn order to mitigate replay attacks, the signatures expire after a\nconfigurable amount of time (default 5 minutes): enough time to fill out\nand submit the form, but short enough to reduce the ability to reuse\nsignatures with known answers.\n\nWhy Make Another One?\n---------------------\n\nThere's lots of Django captchas out there, including more than one that\nuses arithmetic questions just like this one. So why do we need another?\n\nSimply put, the others all lack in flexibility. When I set out to find\none for my form, I needed one that would allow me to manually render my\nfields; the first few I found, however, hardcoded the question (as a\nlabel) into the ``format_output()`` method, or even directly in the\n``render()`` method itself. This meant I couldn't separately render the\nlabel where I need it for my design. I kept digging, and found another\nthat offered the flexibility I needed in the layout, but put the captcha\ngeneration logic in the field's ``__init__()`` method. While this sounds\ngreat, Django's method of using class objects -- rather than instance\nobjects -- means that you get only a single captcha question per server\nthread, period.\n\nSo I sat down to write a captcha that would give me the flexibility I\nneeded to fit into my front-end design, but that also would reliably\ngenerate a fresh captcha question each time the page was loaded.\n\nThis is that captcha.\n\nInstallation\n------------\n\nFrom PyPi\n~~~~~~~~~\n\n(Recommended)\nInstall from PyPi with a simple ``pip install django-simplecaptcha``.\n\nFrom Source\n~~~~~~~~~~~\n\nDownload the source `from GitHub `__,\nand simply make the ``simplecaptcha`` module available to Python in some way; on\n\\*nix systems, a simple symlink in the root of your Django project to the\n``simplecaptcha`` directory is probably the most straightforward solution.\n\nUsing the Captcha\n-----------------\n\nUsing simplecaptcha is simple:\n\n.. code:: python\n\n from simplecaptcha import captcha\n\n @captcha\n class MyForm(Form):\n pass\n\nThis will add a field named \"captcha\" to MyForm. However, nothing else\nneed be done: the decorator takes care of adding the field and ensuring\nit is always updated when a new form instance is created, as well as\nvalidating bound forms and providing useful error messages for users.\n\nAdvanced Use\n~~~~~~~~~~~~\n\nConfiguring simplecaptcha\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nsimplecaptcha, as its name implies, is simple. It works straight out of\nthe box without any need to add any configuration in your Django\nproject. However, if you do want to modify its behavior, you can do that\nas well, by simply adding any of these settings to your Django project's\nsettings module:\n\n- ``SIMPLECAPTCHA_DURATION``: Defines how long (in seconds) a captcha\n is considered valid for; default: 300 seconds (5 minutes)\n- ``SIMPLECAPTCHA_ITERATIONS``: The cryptographic signature passed to\n the client and used to validate the captcha is hashed multiple times\n for security. You can change the number of iterations used with this\n setting; default: 1024\n- ``SIMPLECAPTCHA_DEFAULT_FIELD_NAME``: The default field name used in\n the ``captcha`` decorator; default: 'captcha'\n\nControlling Field Order\n^^^^^^^^^^^^^^^^^^^^^^^\n\nThe decorator will always add the captcha field to the end of your form.\nIf this is undesirable for any reason, you can of course always manually\nrender your form fields as `decribed in the Django\ndocs `__.\n\nAnother option is to simply add a \"dummy\" field to your form with the\nsame name as that used by the decorator. The decorator would then\neffectively replace the field in your form:\n\n.. code:: python\n\n from simplecaptcha import captcha\n from simplecaptcha.fields import CaptchaField\n\n @captcha\n class MyForm(Form):\n field1 = CharField()\n field2 = CharField()\n captcha = CaptchaField()\n field3 = CharField()\n\n(NOTE: Since the decorator will *replace* the field of the same name, it\ndoes not matter what type of field you specify when using this approach.\nBecause of the way Django processes Form classes, however, you *must*\nspecify a Django field, or else Django will ignore it and you won't get\nthe desired effect.)\n\nNow when you render MyForm in your template, fields will be ordered\nprecisely as they are in your source: field1, then field2, followed by\ncaptcha, and finally field3.\n\nSpecifying the Field Name\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nIf for any reason you don't want your captcha field to be named\n\"captcha\", and you don't want to set\n``SIMPLECAPTCHA_DEFAULT_FIELD_NAME`` in your Django settings module, you\ncan use the ``@captchaform`` decorator and supply the desired field name\nas an argument, like so:\n\n.. code:: python\n\n from simplecaptcha import captchaform\n\n @captchaform('securitycheck')\n class MyForm(Form):\n pass\n\nThis will add a field named \"securitycheck\" to MyForm that will contain\nthe form's captcha.\n\nIf you wish to do this and use the method in the previous section to\nspecify the field order, note that the \"dummy\" field you add must match\nthe name you passed into the decorator.\n\nMultiple Captcha Fields\n^^^^^^^^^^^^^^^^^^^^^^^\n\nIt is possible to add multiple captcha fields to your form simply by\ndecorating your form multiple times. However note that field order in\nyour form will be the *reverse* of the order that you write your\ndecorators:\n\n.. code:: python\n\n from simplecaptcha import captchaform\n\n @captchaform('captcha')\n @captchaform('captcha2')\n class MyForm(Form):\n pass\n\nIn this example, when MyForm is rendered in your template, \"captcha2\"\nwill appear *first*, and then \"captcha\". This is a consequence of how\ndecorators in Python are processed; you simply have to remember that the\nlast captcha decorated into your form is the first one that will appear\nin your templates.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Kromey/django-simplecaptcha", "keywords": "django simple math captcha", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-simplecaptcha", "package_url": "https://pypi.org/project/django-simplecaptcha/", "platform": "", "project_url": "https://pypi.org/project/django-simplecaptcha/", "project_urls": { "Homepage": "https://github.com/Kromey/django-simplecaptcha" }, "release_url": "https://pypi.org/project/django-simplecaptcha/2.0.0/", "requires_dist": null, "requires_python": "", "summary": "A simple math-based captcha for Django forms", "version": "2.0.0", "yanked": false, "yanked_reason": null }, "last_serial": 6015316, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "bf79a28a91be84470f4ba1849d02d332", "sha256": "260e2fa8857c6a298f0af2a55631f91401f2085f9dc2be09897facc9119f8022" }, "downloads": -1, "filename": "django_simplecaptcha-1.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "bf79a28a91be84470f4ba1849d02d332", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12655, "upload_time": "2015-11-11T19:23:45", "upload_time_iso_8601": "2015-11-11T19:23:45.920066Z", "url": "https://files.pythonhosted.org/packages/5f/29/ad038a0fa0d7795a1b37fe5e1bee859c61c15874e83cfbec0ef1a74f16c8/django_simplecaptcha-1.0.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "9834f3a4cd4f48a5245c3a092163ad6e", "sha256": "1cf0960dc15cadaf9d69f69888036b80c784075da7bfecaee6935674187f960a" }, "downloads": -1, "filename": "django-simplecaptcha-1.0.0.tar.gz", "has_sig": false, "md5_digest": "9834f3a4cd4f48a5245c3a092163ad6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9611, "upload_time": "2015-11-11T19:23:50", "upload_time_iso_8601": "2015-11-11T19:23:50.662289Z", "url": "https://files.pythonhosted.org/packages/e3/b8/9bb760bae9b483043ad388a43b907cbc40dbd8fcd8fdae604a8811c1e713/django-simplecaptcha-1.0.0.tar.gz", "yanked": false, "yanked_reason": null } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "db7136aea1ef1e423f699f7504a9d224", "sha256": "903dc42b9de2a8d1589de05b608391bccae7a228de985e94e05ed6e577ec0884" }, "downloads": -1, "filename": "django-simplecaptcha-2.0.0.tar.gz", "has_sig": false, "md5_digest": "db7136aea1ef1e423f699f7504a9d224", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9577, "upload_time": "2019-10-22T21:20:28", "upload_time_iso_8601": "2019-10-22T21:20:28.909216Z", "url": "https://files.pythonhosted.org/packages/04/2a/c396fa645bc19e67fba6faa0de743d5b315bc31a3be374f7b661848c05e1/django-simplecaptcha-2.0.0.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "db7136aea1ef1e423f699f7504a9d224", "sha256": "903dc42b9de2a8d1589de05b608391bccae7a228de985e94e05ed6e577ec0884" }, "downloads": -1, "filename": "django-simplecaptcha-2.0.0.tar.gz", "has_sig": false, "md5_digest": "db7136aea1ef1e423f699f7504a9d224", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9577, "upload_time": "2019-10-22T21:20:28", "upload_time_iso_8601": "2019-10-22T21:20:28.909216Z", "url": "https://files.pythonhosted.org/packages/04/2a/c396fa645bc19e67fba6faa0de743d5b315bc31a3be374f7b661848c05e1/django-simplecaptcha-2.0.0.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }