django-rest-auth/dj_rest_auth/tests/django_urls.py

46 lines
2.3 KiB
Python
Raw Normal View History

2015-04-17 10:53:46 +03:00
# Moved in Django 1.8 from django to tests/auth_tests/urls.py
2016-06-28 21:20:53 +03:00
from django.conf.urls import url
2015-04-17 10:53:46 +03:00
from django.contrib.auth.decorators import login_required
from django.contrib.auth.urls import urlpatterns
2020-03-01 04:46:32 +03:00
try:
from django.contrib.auth.views import (
logout, login, password_reset,
password_change, password_reset_confirm
)
except ImportError:
from django.contrib.auth.views import (
LoginView, LogoutView, PasswordResetView,
PasswordChangeView, PasswordResetConfirmView
)
logout = LogoutView.as_view()
login = LoginView.as_view()
password_reset = PasswordResetView.as_view()
password_change = PasswordChangeView.as_view()
password_reset_confirm = PasswordResetConfirmView.as_view()
2015-04-17 10:53:46 +03:00
# special urls for auth test cases
urlpatterns += [
2020-03-01 04:46:32 +03:00
url(r'^logout/custom_query/$', logout, dict(redirect_field_name='follow')),
url(r'^logout/next_page/$', logout, dict(next_page='/somewhere/')),
url(r'^logout/next_page/named/$', logout, dict(next_page='password_reset')),
url(r'^password_reset_from_email/$', password_reset, dict(from_email='staffmember@example.com')),
url(r'^password_reset/custom_redirect/$', password_reset, dict(post_reset_redirect='/custom/')),
url(r'^password_reset/custom_redirect/named/$', password_reset, dict(post_reset_redirect='password_reset')),
url(r'^password_reset/html_email_template/$', password_reset,
2015-04-17 10:53:46 +03:00
dict(html_email_template_name='registration/html_password_reset_email.html')),
url(r'^reset/custom/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
2020-03-01 04:46:32 +03:00
password_reset_confirm,
2015-04-17 10:53:46 +03:00
dict(post_reset_redirect='/custom/')),
url(r'^reset/custom/named/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
2020-03-01 04:46:32 +03:00
password_reset_confirm,
2015-04-17 10:53:46 +03:00
dict(post_reset_redirect='password_reset')),
2020-03-01 04:46:32 +03:00
url(r'^password_change/custom/$', password_change, dict(post_change_redirect='/custom/')),
url(r'^password_change/custom/named/$', password_change, dict(post_change_redirect='password_reset')),
url(r'^admin_password_reset/$', password_reset, dict(is_admin_site=True)),
url(r'^login_required/$', login_required(password_reset)),
url(r'^login_required_login_url/$', login_required(password_reset, login_url='/somewhere/')),
2015-04-28 11:04:20 +03:00
]