{ "info": { "author": "Leone Bacciu", "author_email": "leonebacciu@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Account credentials checker\n\nThis package takes care of verifing the credentials serverside.\n\n## Download\nYou can `pip install` by\n```commandline\npip3 install Credentials-Validator\n```\n\n## Usage\n\nYou can import the pakage by typing\n\n```python\nfrom Credentials_Validator import UsernameValidator, PasswordValidator\n```\n\\\nThe general usage is:\n\n```python\nfrom Credentials_Validator import UsernameValidator\n\nuser = UsernameValidator([4], # length range\n [1], # number of lower-case chars range\n [1], # number of upper-case chars range\n [1,3], # number of numbers range\n [0,0], # number of symbols range\n )\n```\n\\\nThe use of range is:\n\n```python\n[2, 5] # minimum 2, maximum 5 characters\n[1] # at least one\n[0] # not necessary, not denied\n[0, 4] # not necessary, maximum 4 characters\n[0, 0] # denied\n```\n\n### Validation\nIn order to validate a `text` (Username or password) you have to call the method `Validator.verify(text)`.\\\nIt returns two objects:\n1. a `boolean` (`True` if the text is valid, `False` if there is one or more errors)\n2. a `string`, that can be:\n * `''` empty, if there are no errors\n * `'length'` if the `text` is too short or too long\n * `'lower'` if there are too few or too many lower-case characters\n * `'upper'` if there are too few or too many upper-case characters\n * `'digit'` if there are too few or too many numbers\n * `'symbols'` if there are too few or too many allowed symbols\n```python\nfrom Credentials_Validator import UsernameValidator\n\nuser = UsernameValidator([4, 10], [1], [2], [0], [1],)\n\nis_valid, error = user.verify('PasswOrd!')\nprint((is_valid, error))\n#returns (True, '')\n\nis_valid, error = user.verify('PasswOrd3')\nprint((is_valid, error))\n#returns (False, 'symbols')\n\nis_valid, error = user.verify('Password!')\nprint((is_valid, error))\n#returns (False, 'upper')\n\nis_valid, error = user.verify('th1sPasswOrdist00long')\nprint((is_valid, error))\n#returns (False, 'length')\n```\n\n## Differences between UsernameValidator and PasswordValidator\n\n### UsernameValidator\nThe `UsernameValidator` comes with a special argument called `django_model`.\\\nIt can be used to automatically check if the username is already taken in the Django User model, if it is taken, it will return the error `'existing'`\\\nIn this example the default User model is passed:\n```python\nfrom django.contrib.auth.models import User\nfrom Credentials_Validator import UsernameValidator\n\nuser = UsernameValidator([4,10], [1], [1], [2], [0,0], django_model=User)\n```\nIf you are using a custom Django User model:\n```python\nfrom django.contrib.auth import get_user_model\nfrom Credentials_Validator import UsernameValidator\n\nuser = UsernameValidator([4,10], [1], [1], [2], [0,0], django_model=get_user_model())\n```\n\n### PasswordValidator\nThe `PasswordValidator` comes with a special argument called `username`.\\\nIt checks if the password is the same as the username, in which case it returns the `'equal'` error.\\\n```python\nfrom Credentials_Validator import PasswordValidator\n\nusername = 'myusername'\n\npassword = PasswordValidator([8,12], [2], [2], [2], [1], username=username)\n```\n## Extra features\n\n### Customization\n\\\nThe default symbols are: `!\"#$%&'()*+,-./:;<=>?@[\\]^_{|}~`.\\\n\\\nYou can customize the simbols by passing your custom list (string) as a keyword argument:\n\n```python\nfrom Credentials_Validator import UsernameValidator\n\nmy_symbols = '!?$%&@#'\n\nuser = UsernameValidator([4, 10], [1], [1], [0], [1], symbols_list=my_symbols)\n```\n\n### Inheritance\nYou can add your custom verification function by inheriting the `Validator` class and overriding the `__init__` method to add keyword arguments and `extra_validation` one to add your validatin function.\\\nThe `__init__` should look like this:\n```python\nfrom Credentials_Validator import Validator\n\nclass MyValidator(Validator):\n\n def __init__(self, length, chars, Chars, nums, symbols, **kwargs):\n super().__init__(length, chars, Chars, nums, symbols, **kwargs) # DON'T EDIT THIS!\n\n self.myargument = kwargs.get('mykeyword', None) # Edit 'myargument' and 'mykeyword'\n``` \nThe `extra_validation` should return `None` if the `text` is valid, if it is not, `False` and `myerrormessage` (can be anything)\n```python\n def extra_validation(self, text): # text is the .verify() argument\n if self.myargument in text: # can be any condition\n return False, 'myerror'\n return None\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/LeoneBacciu/Credentials_Validator", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "Credentials-Validator", "package_url": "https://pypi.org/project/Credentials-Validator/", "platform": "", "project_url": "https://pypi.org/project/Credentials-Validator/", "project_urls": { "Homepage": "https://github.com/LeoneBacciu/Credentials_Validator" }, "release_url": "https://pypi.org/project/Credentials-Validator/0.0.4/", "requires_dist": null, "requires_python": ">=3.6", "summary": "Credential validation", "version": "0.0.4" }, "last_serial": 5831343, "releases": { "0.0.2": [ { "comment_text": "", "digests": { "md5": "20958e55ae4d614dedb7b66239f0c596", "sha256": "0576558559280586734dd724d25817c94243b84ef8a4a2064329b1d71c5002b2" }, "downloads": -1, "filename": "Credentials_Validator-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "20958e55ae4d614dedb7b66239f0c596", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 4430, "upload_time": "2019-09-14T18:46:38", "url": "https://files.pythonhosted.org/packages/ae/79/cc0c03fea44d83d1729d6c917c71c9b2031de9232c58f3edad91a42a4540/Credentials_Validator-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "923de64df8afff850b04fab170b9592c", "sha256": "9f4bd9a118fccfba7f5c58f18aec52c874c04cfee38e49ffe048b610c1765bf0" }, "downloads": -1, "filename": "Credentials_Validator-0.0.2.tar.gz", "has_sig": false, "md5_digest": "923de64df8afff850b04fab170b9592c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 2780, "upload_time": "2019-09-14T18:46:40", "url": "https://files.pythonhosted.org/packages/d3/58/52fd7698711d5ee5a20fd7d5c87a7e1183650f9991bed4c9178dc22322bd/Credentials_Validator-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "4a4aeaf802cc17f79993bff7cae0b60c", "sha256": "eed2ed8b51d92d5270e870805f56d3c4e2da2cf708c36d74d7f6a2b23ce46d46" }, "downloads": -1, "filename": "Credentials_Validator-0.0.3-py3-none-any.whl", "has_sig": false, "md5_digest": "4a4aeaf802cc17f79993bff7cae0b60c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 4468, "upload_time": "2019-09-14T19:35:54", "url": "https://files.pythonhosted.org/packages/46/e2/ad412655c67db2a87b529bd06d9b8e00794e8eb198222b10ddffe1bbef93/Credentials_Validator-0.0.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "643d31177b015ccde54116a2f2204fba", "sha256": "fdf980bd8453aa2aae928a4210d95fc42754ad60b2f9b7a2904f2f7fba541283" }, "downloads": -1, "filename": "Credentials_Validator-0.0.3.tar.gz", "has_sig": false, "md5_digest": "643d31177b015ccde54116a2f2204fba", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 2820, "upload_time": "2019-09-14T19:35:56", "url": "https://files.pythonhosted.org/packages/4d/dc/4c100e463263065e5f6d4c9fc15d27d74796a09d66cbf7ed348be558bf8f/Credentials_Validator-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "c97c1a186294a5b7283badb9669800f3", "sha256": "cd87b5c99f8c6af8ee094353080f80655e292b6e541047f5bda5206083489ca9" }, "downloads": -1, "filename": "Credentials_Validator-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "c97c1a186294a5b7283badb9669800f3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5452, "upload_time": "2019-09-15T10:07:40", "url": "https://files.pythonhosted.org/packages/0f/11/c3267787a74db75fbf5808eb3fdefdb40dc321d6537ebd816a0bd36d781f/Credentials_Validator-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8c03ec591ca6c85a8e246d7755df9af1", "sha256": "b94436c823f93ba3fabb8d20c465314fc5742bc8564f0431654f88713efb8703" }, "downloads": -1, "filename": "Credentials_Validator-0.0.4.tar.gz", "has_sig": false, "md5_digest": "8c03ec591ca6c85a8e246d7755df9af1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3909, "upload_time": "2019-09-15T10:07:41", "url": "https://files.pythonhosted.org/packages/e7/f6/558a82787dc6d856cc4dd41ce852580b8c53370790c010db4b5f82d267f7/Credentials_Validator-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c97c1a186294a5b7283badb9669800f3", "sha256": "cd87b5c99f8c6af8ee094353080f80655e292b6e541047f5bda5206083489ca9" }, "downloads": -1, "filename": "Credentials_Validator-0.0.4-py3-none-any.whl", "has_sig": false, "md5_digest": "c97c1a186294a5b7283badb9669800f3", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5452, "upload_time": "2019-09-15T10:07:40", "url": "https://files.pythonhosted.org/packages/0f/11/c3267787a74db75fbf5808eb3fdefdb40dc321d6537ebd816a0bd36d781f/Credentials_Validator-0.0.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8c03ec591ca6c85a8e246d7755df9af1", "sha256": "b94436c823f93ba3fabb8d20c465314fc5742bc8564f0431654f88713efb8703" }, "downloads": -1, "filename": "Credentials_Validator-0.0.4.tar.gz", "has_sig": false, "md5_digest": "8c03ec591ca6c85a8e246d7755df9af1", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3909, "upload_time": "2019-09-15T10:07:41", "url": "https://files.pythonhosted.org/packages/e7/f6/558a82787dc6d856cc4dd41ce852580b8c53370790c010db4b5f82d267f7/Credentials_Validator-0.0.4.tar.gz" } ] }