{ "info": { "author": "Christian Kreuzberger", "author_email": "ckreuzberger@anexia-it.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 1.8", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "# Django Rest Password Reset\n\nThis python package provides a simple password reset strategy for django rest framework, where users can request password \nreset tokens via their registered e-mail address.\n\nThe main idea behind this package is to not make any assumptions about how the token is delivered to the end-user (e-mail, text-message, etc...).\nInstead, this package provides a signal that can be reacted on (e.g., by sending an e-mail or a text message).\n\nThis package basically provides two REST endpoints:\n\n* Request a token\n* Verify (confirm) a token (and change the password)\n\n## Quickstart\n\n1. Install the package from pypi using pip:\n```bash\npip install django-rest-passwordreset\n```\n\n2. Add ``django_rest_passwordreset`` to your ``INSTALLED_APPS`` (after ``rest_framework``) within your Django settings file:\n```python\nINSTALLED_APPS = (\n ...\n 'django.contrib.auth',\n ...\n 'rest_framework',\n ...\n 'django_rest_passwordreset',\n ...\n)\n```\n\n3. This package provides two endpoints, which can be included by including ``django_rest_passwordreset.urls`` in your ``urls.py`` as follows:\n```python\nfrom django.conf.urls import url, include\n\n\nurlpatterns = [\n ...\n url(r'^api/password_reset/', include('django_rest_passwordreset.urls', namespace='password_reset')),\n ...\n] \n```\n**Note**: You can adapt the url to your needs.\n\n### Endpoints\n\nThe following endpoints are provided:\n\n * `reset_password` - request a reset password token by using the ``email`` parameter\n * `reset_password/confirm` - using a valid ``token``, the users password is set to the provided ``password``\n \n### Signals\n\n* ``reset_password_token_created(reset_password_token)`` Fired when a reset password token is generated\n* ``pre_password_reset(user)`` - fired just before a password is being reset\n* ``post_password_reset(user)`` - fired after a password has been reset\n\n### Example for sending an e-mail\n\n1. Create two new django templates: `email/user_reset_password.html` and `email/user_reset_password.txt`. Those templates will contain the e-mail message sent to the user, aswell as the password reset link (or token).\nWithin the templates, you can access the following context variables: `current_user`, `username`, `email`, `reset_password_url`. Feel free to adapt this to your needs.\n\n2. Add the following code, which contains a Django Signal, to your application (see [this part of the django documentation](https://docs.djangoproject.com/en/1.11/topics/signals/#connecting-receiver-functions) for more information on where to put signals).\n```python\nfrom django.dispatch import receiver\nfrom django_rest_passwordreset.signals import reset_password_token_created\n\n\n@receiver(reset_password_token_created)\ndef password_reset_token_created(sender, reset_password_token, *args, **kwargs):\n \"\"\"\n Handles password reset tokens\n When a token is created, an e-mail needs to be sent to the user\n :param sender:\n :param reset_password_token:\n :param args:\n :param kwargs:\n :return:\n \"\"\"\n # send an e-mail to the user\n context = {\n 'current_user': reset_password_token.user,\n 'username': reset_password_token.user.username,\n 'email': reset_password_token.user.email,\n # ToDo: The URL can (and should) be constructed using pythons built-in `reverse` method.\n 'reset_password_url': \"http://some_url/reset/?token={token}\".format(token=reset_password_token.key)\n }\n\n # render email text\n email_html_message = render_to_string('email/user_reset_password.html', context)\n email_plaintext_message = render_to_string('email/user_reset_password.txt', context)\n\n msg = EmailMultiAlternatives(\n # title:\n _(\"Password Reset for {title}\".format(title=\"Some website title\")),\n # message:\n email_plaintext_message,\n # from:\n \"noreply@somehost.local\",\n # to:\n [reset_password_token.user.email]\n )\n msg.attach_alternative(email_html_message, \"text/html\")\n msg.send()\n\n```\n\n3. You should now be able to use the endpoints to request a password reset token via your e-mail address. \nIf you want to test this locally, I recommend using some kind of fake mailserver (such as maildump).\n\n## Tests\n\nSee folder [tests/](tests/). Basically, all endpoints are covered with multiple\nunit tests.\n\nUse this code snippet to run tests:\n```bash\npip install -r requirements_test.txt\npython setup.py install\ncd tests\npython manage.py test\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/alonraiz/django-rest-passwordreset", "keywords": "", "license": "BSD License", "maintainer": "", "maintainer_email": "", "name": "django2-rest-passwordreset", "package_url": "https://pypi.org/project/django2-rest-passwordreset/", "platform": "", "project_url": "https://pypi.org/project/django2-rest-passwordreset/", "project_urls": { "Homepage": "https://github.com/alonraiz/django-rest-passwordreset" }, "release_url": "https://pypi.org/project/django2-rest-passwordreset/1.3.1/", "requires_dist": null, "requires_python": "", "summary": "An extension of django rest framework, providing a password reset strategy", "version": "1.3.1" }, "last_serial": 5752068, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "e0367711cb270c80ccab7c61598dd725", "sha256": "712615037318dfa4f64b63dff9b1f38b5c75306598cd06fe89aad5afbe78ee95" }, "downloads": -1, "filename": "django2-rest-passwordreset-1.0.0.tar.gz", "has_sig": false, "md5_digest": "e0367711cb270c80ccab7c61598dd725", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14586, "upload_time": "2019-02-13T11:51:15", "url": "https://files.pythonhosted.org/packages/98/e5/0edb983d6c438562edbcb0fb8762d8cd1bd72e3fc855d95ceb1f51b24b34/django2-rest-passwordreset-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "c1a8d81c9fc785157277bb80c4d31459", "sha256": "d7bc6048256083c41c1035c84b00619a66704c4b7feab2d0c6b6976ff2c4c9f1" }, "downloads": -1, "filename": "django2-rest-passwordreset-1.0.1.tar.gz", "has_sig": false, "md5_digest": "c1a8d81c9fc785157277bb80c4d31459", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14540, "upload_time": "2019-02-13T12:00:46", "url": "https://files.pythonhosted.org/packages/0d/e7/d41d43b1c417f5157aa4fe68dcf4515d9754bad1e9e67ca09549f5d68afb/django2-rest-passwordreset-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "ff76b4b7806117d7250d7d1ce508584e", "sha256": "99fcc23e461387b726d0f5f42627d671baa3ddba8063427ce113cf493423cefa" }, "downloads": -1, "filename": "django2-rest-passwordreset-1.1.0.tar.gz", "has_sig": false, "md5_digest": "ff76b4b7806117d7250d7d1ce508584e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14708, "upload_time": "2019-03-17T12:20:10", "url": "https://files.pythonhosted.org/packages/ff/ba/f4dfac428bc1395573ae7353a0c12b14e3555b04e81ad3c63c037a6ddc62/django2-rest-passwordreset-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "57c072c422b047cff9323b12c6b683d8", "sha256": "deacc952d57dc56e4ae28280b9ce1cf49b72811d33317499273b154f3864524a" }, "downloads": -1, "filename": "django2-rest-passwordreset-1.2.0.tar.gz", "has_sig": false, "md5_digest": "57c072c422b047cff9323b12c6b683d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14804, "upload_time": "2019-06-23T10:41:04", "url": "https://files.pythonhosted.org/packages/90/20/a4e11455b3f2ec2dbb5c44b818755bf866c39d81655a9428f1ca39846677/django2-rest-passwordreset-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "ddfad17f6ecfc9b3c4e3288123d55001", "sha256": "7df57a006bba109b4aefa5555dd836fc1b4ae25174ac4978e33b73b7c9129a85" }, "downloads": -1, "filename": "django2-rest-passwordreset-1.2.1.tar.gz", "has_sig": false, "md5_digest": "ddfad17f6ecfc9b3c4e3288123d55001", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14810, "upload_time": "2019-06-23T10:57:46", "url": "https://files.pythonhosted.org/packages/91/c9/11a9300a1de14b6882a87cb179d3a8b59bf3089df99952795bfc77d4f307/django2-rest-passwordreset-1.2.1.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "a838450bd6b2a82c779e6cfb6bf0cede", "sha256": "85a930780babd9dfb4c13a85b7badfe7010b64ba3dc70bc16a7ec3eb1d8f2b9f" }, "downloads": -1, "filename": "django2-rest-passwordreset-1.3.0.tar.gz", "has_sig": false, "md5_digest": "a838450bd6b2a82c779e6cfb6bf0cede", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15000, "upload_time": "2019-07-22T14:26:31", "url": "https://files.pythonhosted.org/packages/c0/5d/4fc08bb1c68106a029283b3b71e23b8a87470e34a0167c5f5bbdd973da67/django2-rest-passwordreset-1.3.0.tar.gz" } ], "1.3.1": [ { "comment_text": "", "digests": { "md5": "a12bd1207f98ce19de182308448cda3e", "sha256": "f9ab3aae25b0dee884b5f2e95d91698cab8a3b90e9955e1ec5c494e6dbbd4bc2" }, "downloads": -1, "filename": "django2-rest-passwordreset-1.3.1.tar.gz", "has_sig": false, "md5_digest": "a12bd1207f98ce19de182308448cda3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15281, "upload_time": "2019-08-29T12:27:07", "url": "https://files.pythonhosted.org/packages/d8/53/922c757f360e662ded4d7f05450b42c5ef748650b2041ff328b515c2bb41/django2-rest-passwordreset-1.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a12bd1207f98ce19de182308448cda3e", "sha256": "f9ab3aae25b0dee884b5f2e95d91698cab8a3b90e9955e1ec5c494e6dbbd4bc2" }, "downloads": -1, "filename": "django2-rest-passwordreset-1.3.1.tar.gz", "has_sig": false, "md5_digest": "a12bd1207f98ce19de182308448cda3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15281, "upload_time": "2019-08-29T12:27:07", "url": "https://files.pythonhosted.org/packages/d8/53/922c757f360e662ded4d7f05450b42c5ef748650b2041ff328b515c2bb41/django2-rest-passwordreset-1.3.1.tar.gz" } ] }