Skip to main content

Django Password Reset

This app simplifies the process for adding password reset functionality to your site. It takes advantage of django’s exising password reset workflow, but simplifies the process of adding urls to your site. This also allows you to create multiple password reset workflows for one site using namespacing.

Installation

Just add “passreset” to INSTALLED_APPS, and include passreset.urls in your urlconf module:

from django.conf.urls import url, include
import passreset
urlpatterns = [
    #...
    url(r'^profile/passreset/', include(passreset.urls))
]

You can then link to the password reset form by reversing “passreset:reset-password”:

<a href="{% url "passreset:reset-password" %}">Forgot password?</a>

The app takes care of the rest, with the help of django’s built-in password reset workflow. Note that passreset.urls an object, not a module. Using include(‘passreset.urls’) will raise an ImportError.

To quickly add password reset functionality to your existing admin, just include passreset.admin_urls:

from django.conf.urls.defaults import url, include
import passreset

urlpatterns = [
  url(r'^admin/passreset/', include(passreset.admin_urls),
  url(r'^admin/', include(admin.site.urls)),
)

As an added convenience, the passreset app automatically overrides the default admin site’s login template to add a “forgot password?” link.

Namespacing

If you need multiple password-reset workflows for one site, you must use the passreset.urls_ns() function. Note that you should not use the namespace keyword argument to include:

import passreset
urpatterns = [
    url(r'^profile/reset-password', include(passreset.urls_ns(
        'user-passreset', login_url='/profile/login'))),
    url(r'^staff/reset-password', include(passreset.urls_ns(
        'staff-passreset', login_url='/staff/loging'))),
]

If login_url is not supplied, settings.LOGIN_URL is used. You can also pass a template_path argument to specify a base path for templates used in the app instance.

You can then reverse any of the passreset urls using the new namespace:

<a href="{% url "staff-passreset:reset-password" %}">Forgot password?</a>

Templates

The default templates form passreset all extend “passreset/base.html”, You can create an override for this template in your project (eg, my_project/templates/passreset/base.html), and have it extend your site’s base template. The templates all use a block called passreset_content. So, all you need to do is include that block inside your site’s main content block:

{% extends "mysite/base.html" %}
{% block content %}
  {% block passreset_content %}
  {% endblock %}
{% endblock %}

The urls_ns function also accepts a tpl_path parameter, which allows you to override any of the templates used by passreset. The path is a template directory that may contain any of the following:

  • reset_password.html

  • done.html

  • confirm.html

  • complete.html

  • email.html

  • subject.ttx

Admin

The passreset.admin_urls urlconf is basically a convenience shortcut for passreset.urls_ns(‘admin-passreset’, login_url=’admin:login’). As stated above, passreset overrides the default admin login template with a “Forgot password?” link, which basically looks like this:

<a href="{% url admin-passreset:reset-password }">Forgot password?</a>

You can use the admin passreset urls together with another passreset instance without using namespacing:

urlpatterns += patterns('',
  url(r'^admin/passreset/', include(passreset.admin_urls)),
  url(r'^admin/', include(admin.site.urls)),
  url(r'^profile/passreset', include('passreset.urls')),
)

Metadata

Release files for django-passreset 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-passreset 0.3
File Size Uploaded Provenance
django-passreset-0.3.tar.gz 5.9 kB Without provenance Details

Release files / django-passreset-0.3.tar.gz

Download URL django-passreset-0.3.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
213d437cf6a3d4ebc2788c6d6e0a82916c183a1ae25dbde216f73d753b45f1d4
BLAKE2b-256 checksum
How to use checksums
435cf41fb6a04e5a10f74dd6dfec0c2960f0865e9dae237c98ac4f829971a687
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-passreset 0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page