Name | django-password-validator JSON |
Version |
0.2.0
JSON |
| download |
home_page | |
Summary | django-password-validator is a reusable app that provides a form field and validators that check the strength of a password. |
upload_time | 2024-02-09 04:57:08 |
maintainer | |
docs_url | None |
author | Dharwin Perez |
requires_python | >=3.10,<4.0 |
license | LICENSE |
keywords |
password
validator
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
![Pypi](https://img.shields.io/pypi/v/django-password-validator?style=flat-square)
![Python](https://img.shields.io/pypi/pyversions/django-password-validator?style=flat-square)
![Django](https://img.shields.io/badge/Django-4.0%7C4.1%7C4.2%7C5.0-green)
# Django Password Validator
django-password-validator is a reusable app that provides a form field and
validators that check the strength of a password.
## Installation
You can install django-password-validator with pip by typing::
pip install django-password-validator
Or with poetry by typing::
poetry add django-password-validator
Or manually by downloading a tarball and typing::
python setup.py install
## Settings
django-password-validator adds 6 optional settings
`PASSWORD_MIN_LENGTH` : Specifies minimum length for passwords. Defaults to 6.
`PASSWORD_MAX_LENGTH` : Specifies maximum length for passwords. Defaults to None.
`PASSWORD_DICTIONARY` : Specifies the location of a dictionary (file with one word per line). Defaults to None.
`PASSWORD_MATCH_THRESHOLD` : Specifies how close a fuzzy match has to be to be considered a match. Defaults to 0.9, should be 0.0 - 1.0 where 1.0 means exactly the same.
`PASSWORD_COMMON_SEQUENCES` : Specifies a list of common sequences to attempt to match a password against.
```python
[
"0123456789",
"`1234567890-=",
"~!@#$%^&*()_+",
"abcdefghijklmnopqrstuvwxyz",
"qwertyuiop[]\\asdfghjkl;'zxcvbnm,./",
'qwertyuiop{}|asdfghjkl;"zxcvbnm<>?',
"qwertyuiopasdfghjklzxcvbnm",
"1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik,9ol.0p;/-['=]\\",
"qazwsxedcrfvtgbyhnujmikolp",
"qwertzuiopü+asdfghjklöä#<yxcvbnm,.-",
"qwertzuiopü*asdfghjklöä'>yxcvbnm;:_",
"qaywsxedcrfvtgbzhnujmikolp",
]
```
`PASSWORD_COMPLEXITY` : Specifies number of characters within various sets that a password must contain. You can omit any or all of these for no limit for that particular set.
UPPER: Uppercase
LOWER: Lowercase
LETTERS: Either uppercase or lowercase letters
DIGITS: Digits
SPECIAL: Not alphanumeric, space or punctuation character
WORDS: Words (alphanumeric sequences separated by a whitespace or punctuation character)
```python
PWD_VALIDATOR = {
"PASSWORD_MIN_LENGTH" = 6,
"PASSWORD_MAX_LENGTH" = 120,
"PASSWORD_DICTIONARY" = "/usr/share/dict/words",
"PASSWORD_MATCH_THRESHOLD" = 0.9,
"PASSWORD_COMMON_SEQUENCES" = [],
"PASSWORD_COMPLEXITY" = {
"UPPER": 1,
"LOWER": 1,
"LETTERS": 1,
"DIGITS": 1,
"SPECIAL": 1,
"WORDS": 1
}
}
```
## Usage
To use the formfield simply import it and use it:
```python
from django import forms
from passwords.fields import PasswordField
class ExampleForm(forms.Form):
password = PasswordField(label="Password")
```
You can make use of the validators on your own fields:
```python
from django import forms
from passwords.validators import dictionary_words
field = forms.CharField(validators=[dictionary_words])
```
You can also create custom validator instances to specify your own
field-specific configurations, rather than using the global
configurations:
```python
from django import forms
from passwords.validators import (DictionaryValidator, LengthValidator, ComplexityValidator)
field = forms.CharField(validators=[
DictionaryValidator(words=['banned_word'], threshold=0.9),
LengthValidator(min_length=8),
ComplexityValidator(complexities=dict(
UPPER=1,
LOWER=1,
DIGITS=1
)),
])
```
Django's `password validation API` is slightly different than the form
validation API and has wrappers in the `auth_password_validators` module:
```python
AUTH_PASSWORD_VALIDATORS = [
…,
{"NAME": "passwords.auth_password_validators.ComplexityValidator"}
]
```
`password validation API`: https://docs.djangoproject.com/en/5.0/topics/auth/passwords/#module-django.contrib.auth.password_validation
Raw data
{
"_id": null,
"home_page": "",
"name": "django-password-validator",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "password,validator",
"author": "Dharwin Perez",
"author_email": "dharwin@codelovers.club",
"download_url": "https://files.pythonhosted.org/packages/05/d1/c853d91fb890f54c57fd305fd5e97cddec3b1c27c7534cd7f16b260ee0a2/django_password_validator-0.2.0.tar.gz",
"platform": null,
"description": "![Pypi](https://img.shields.io/pypi/v/django-password-validator?style=flat-square)\n![Python](https://img.shields.io/pypi/pyversions/django-password-validator?style=flat-square)\n![Django](https://img.shields.io/badge/Django-4.0%7C4.1%7C4.2%7C5.0-green)\n\n\n# Django Password Validator\n\ndjango-password-validator is a reusable app that provides a form field and\nvalidators that check the strength of a password.\n\n## Installation\n\nYou can install django-password-validator with pip by typing::\n\n pip install django-password-validator\n\nOr with poetry by typing::\n\n poetry add django-password-validator\n\nOr manually by downloading a tarball and typing::\n\n python setup.py install\n\n## Settings\n\ndjango-password-validator adds 6 optional settings\n\n`PASSWORD_MIN_LENGTH` : Specifies minimum length for passwords. Defaults to 6.\n\n`PASSWORD_MAX_LENGTH` : Specifies maximum length for passwords. Defaults to None.\n\n`PASSWORD_DICTIONARY` : Specifies the location of a dictionary (file with one word per line). Defaults to None.\n\n`PASSWORD_MATCH_THRESHOLD` : Specifies how close a fuzzy match has to be to be considered a match. Defaults to 0.9, should be 0.0 - 1.0 where 1.0 means exactly the same.\n\n`PASSWORD_COMMON_SEQUENCES` : Specifies a list of common sequences to attempt to match a password against.\n\n```python\n[\n \"0123456789\",\n \"`1234567890-=\",\n \"~!@#$%^&*()_+\",\n \"abcdefghijklmnopqrstuvwxyz\",\n \"qwertyuiop[]\\\\asdfghjkl;'zxcvbnm,./\",\n 'qwertyuiop{}|asdfghjkl;\"zxcvbnm<>?',\n \"qwertyuiopasdfghjklzxcvbnm\",\n \"1qaz2wsx3edc4rfv5tgb6yhn7ujm8ik,9ol.0p;/-['=]\\\\\",\n \"qazwsxedcrfvtgbyhnujmikolp\",\n \"qwertzuiop\u00fc+asdfghjkl\u00f6\u00e4#<yxcvbnm,.-\",\n \"qwertzuiop\u00fc*asdfghjkl\u00f6\u00e4'>yxcvbnm;:_\",\n \"qaywsxedcrfvtgbzhnujmikolp\",\n]\n```\n\n`PASSWORD_COMPLEXITY` : Specifies number of characters within various sets that a password must contain. You can omit any or all of these for no limit for that particular set.\n\n UPPER: Uppercase\n LOWER: Lowercase\n LETTERS: Either uppercase or lowercase letters\n DIGITS: Digits\n SPECIAL: Not alphanumeric, space or punctuation character\n WORDS: Words (alphanumeric sequences separated by a whitespace or punctuation character)\n\n\n```python\nPWD_VALIDATOR = {\n \"PASSWORD_MIN_LENGTH\" = 6,\n \"PASSWORD_MAX_LENGTH\" = 120,\n \"PASSWORD_DICTIONARY\" = \"/usr/share/dict/words\",\n \"PASSWORD_MATCH_THRESHOLD\" = 0.9,\n \"PASSWORD_COMMON_SEQUENCES\" = [],\n \"PASSWORD_COMPLEXITY\" = {\n \"UPPER\": 1,\n \"LOWER\": 1,\n \"LETTERS\": 1,\n \"DIGITS\": 1,\n \"SPECIAL\": 1,\n \"WORDS\": 1\n }\n}\n```\n\n## Usage\n\nTo use the formfield simply import it and use it:\n\n```python\nfrom django import forms\nfrom passwords.fields import PasswordField\n\nclass ExampleForm(forms.Form):\n password = PasswordField(label=\"Password\")\n```\n\nYou can make use of the validators on your own fields:\n\n```python\nfrom django import forms\nfrom passwords.validators import dictionary_words\n\nfield = forms.CharField(validators=[dictionary_words])\n```\n\nYou can also create custom validator instances to specify your own\nfield-specific configurations, rather than using the global\nconfigurations:\n\n```python\nfrom django import forms\nfrom passwords.validators import (DictionaryValidator, LengthValidator, ComplexityValidator)\n\nfield = forms.CharField(validators=[\n DictionaryValidator(words=['banned_word'], threshold=0.9),\n LengthValidator(min_length=8),\n ComplexityValidator(complexities=dict(\n UPPER=1,\n LOWER=1,\n DIGITS=1\n )),\n])\n```\n\nDjango's `password validation API` is slightly different than the form\nvalidation API and has wrappers in the `auth_password_validators` module:\n\n```python\nAUTH_PASSWORD_VALIDATORS = [\n \u2026,\n {\"NAME\": \"passwords.auth_password_validators.ComplexityValidator\"}\n ]\n```\n\n`password validation API`: https://docs.djangoproject.com/en/5.0/topics/auth/passwords/#module-django.contrib.auth.password_validation\n",
"bugtrack_url": null,
"license": "LICENSE",
"summary": "django-password-validator is a reusable app that provides a form field and validators that check the strength of a password.",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [
"password",
"validator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5e59d2278422137eaf23dcac8dc93ca993f84189544f634d0ac27687b46da504",
"md5": "96c26b5a99b511ca608ac921f44b3d60",
"sha256": "aa1e5563b8522dcfa6057ccf447174305d5a0927be7d6c53332dd2b4fabd33b4"
},
"downloads": -1,
"filename": "django_password_validator-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "96c26b5a99b511ca608ac921f44b3d60",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 37631,
"upload_time": "2024-02-09T04:57:06",
"upload_time_iso_8601": "2024-02-09T04:57:06.404613Z",
"url": "https://files.pythonhosted.org/packages/5e/59/d2278422137eaf23dcac8dc93ca993f84189544f634d0ac27687b46da504/django_password_validator-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "05d1c853d91fb890f54c57fd305fd5e97cddec3b1c27c7534cd7f16b260ee0a2",
"md5": "4b28b1310da343ffdd3b9bbe7602064d",
"sha256": "5313a72a9134de2a85612ba6384bac457fc41514e82d76cb6622cc86f089d9e4"
},
"downloads": -1,
"filename": "django_password_validator-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "4b28b1310da343ffdd3b9bbe7602064d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 17448,
"upload_time": "2024-02-09T04:57:08",
"upload_time_iso_8601": "2024-02-09T04:57:08.139598Z",
"url": "https://files.pythonhosted.org/packages/05/d1/c853d91fb890f54c57fd305fd5e97cddec3b1c27c7534cd7f16b260ee0a2/django_password_validator-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-09 04:57:08",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "django-password-validator"
}