Last active
December 23, 2018 02:25
-
-
Save tenomoto/07cd0de2e4cacfb7edfcbdd19a3b0b12 to your computer and use it in GitHub Desktop.
add password reset to django admin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use console backend for development | |
# https://docs.djangoproject.com/en/2.1/ref/settings/#std:setting-EMAIL_BACKEND | |
# https://docs.djangoproject.com/en/2.1/topics/email/#django.core.mail.backends.smtp.EmailBackend | |
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' | |
# use admin site to login | |
# https://docs.djangoproject.com/en/2.1/ref/settings/#std:setting-LOGIN_URL | |
LOGIN_URL = '/admin/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#adding-a-password-reset-feature | |
from django.contrib import admin | |
from django.contrib.auth import views as auth_views | |
from django.urls import path | |
urlpatterns = [ | |
path('admin/', admin.site.urls), | |
path( | |
'admin/password_reset/', | |
auth_views.PasswordResetView.as_view(), | |
name='admin_password_reset', | |
), | |
path( | |
'admin/password_reset/done/', | |
auth_views.PasswordResetDoneView.as_view(), | |
name='password_reset_done', | |
), | |
path( | |
'reset/<uidb64>/<token>/', | |
auth_views.PasswordResetConfirmView.as_view(), | |
name='password_reset_confirm', | |
), | |
path( | |
'reset/done/', | |
auth_views.PasswordResetCompleteView.as_view(), | |
name='password_reset_complete', | |
), | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment