2014-04-30 23:52:05 +04:00
|
|
|
from django.conf import settings
|
|
|
|
from django.conf.urls import patterns, url, include
|
2014-10-01 17:31:10 +04:00
|
|
|
from django.views.generic import TemplateView
|
2014-04-30 23:52:05 +04:00
|
|
|
|
2014-10-01 16:13:21 +04:00
|
|
|
from rest_auth.views import Login, Logout, UserDetails, \
|
|
|
|
PasswordChange, PasswordReset, PasswordResetConfirm
|
2014-04-30 23:52:05 +04:00
|
|
|
|
|
|
|
|
|
|
|
urlpatterns = patterns('rest_auth.views',
|
2014-05-01 00:55:04 +04:00
|
|
|
# URLs that do not require a session or valid token
|
|
|
|
url(r'^password/reset/$', PasswordReset.as_view(),
|
|
|
|
name='rest_password_reset'),
|
2014-10-07 17:08:08 +04:00
|
|
|
url(r'^password/reset/confirm/$',
|
2014-05-01 00:55:04 +04:00
|
|
|
PasswordResetConfirm.as_view(
|
|
|
|
), name='rest_password_reset_confirm'),
|
|
|
|
url(r'^login/$', Login.as_view(), name='rest_login'),
|
2014-04-30 23:52:05 +04:00
|
|
|
|
2014-05-01 00:55:04 +04:00
|
|
|
# URLs that require a user to be logged in with a valid
|
|
|
|
# session / token.
|
|
|
|
url(r'^logout/$', Logout.as_view(), name='rest_logout'),
|
|
|
|
url(r'^user/$', UserDetails.as_view(),
|
|
|
|
name='rest_user_details'),
|
|
|
|
url(r'^password/change/$', PasswordChange.as_view(),
|
|
|
|
name='rest_password_change'),
|
|
|
|
)
|
2014-04-30 23:52:05 +04:00
|
|
|
|
2014-05-30 13:17:25 +04:00
|
|
|
if getattr(settings, 'IS_TEST', False):
|
2014-05-06 02:53:06 +04:00
|
|
|
from django.contrib.auth.tests import urls
|
2014-10-01 16:13:21 +04:00
|
|
|
urlpatterns += patterns('',
|
|
|
|
url(r'^rest-registration/', include('registration.urls')),
|
2014-10-01 17:31:10 +04:00
|
|
|
url(r'^test-admin/', include(urls)),
|
|
|
|
url(r'^account-email-verification-sent/$', TemplateView.as_view(),
|
|
|
|
name='account_email_verification_sent'),
|
|
|
|
url(r'^account-confirm-email/(?P<key>\w+)/$', TemplateView.as_view(),
|
|
|
|
name='account_confirm_email'),
|
2014-10-01 16:13:21 +04:00
|
|
|
)
|