from django.conf.urls import url from django.contrib.auth import views as auth_views from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ from shared.views import Home from users.views import CreateUser app_name = 'users' urlpatterns = [ # CREATE USER url(r'^create/$', CreateUser.as_view(), name='create_user'), # LOGIN url(r'^login/$', auth_views.login, {'template_name': 'users/login.html', 'extra_context': { 'page_title': _('Connexion'), 'button': _('Se connecter'), }, }, name='login', ), # LOGOUT url(r'^logout/$', auth_views.logout, name='logout',), # PASSWORD_CHANGE url(r'^password_change/$', auth_views.password_change, {'template_name': 'users/change_pass.html', 'post_change_redirect': reverse_lazy('shared:home'), 'extra_context': { 'page_title': _('Changement de mot de passe'), 'button': _('Modifier'), }, }, name='password_change'), # url('^password_change/done/$', name='password_change_done'), # RESET PASSWORD url(r'^password_reset/$', auth_views.password_reset, {'template_name': 'users/password_reset.html', 'email_template_name': 'email_password_reset.html', 'subject_template_name': 'subject_password_reset.txt', 'post_reset_redirect': reverse_lazy('users:password_reset_done'), 'extra_context': { 'page_title': _('Demander un nouveau mot de passe'), 'button': _('Envoyer') }, }, name='password_reset'), # PASS RESET DONE url(r'^password_reset/done/$', Home.as_view(), name='password_reset_done'), # PASS RESET CONFIRM url('^reset/(?P[0-9A-Za-z_\-]+)/' '(?P[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', auth_views.password_reset_confirm, { 'template_name': 'user/user_form.html', 'post_reset_redirect': reverse_lazy( 'user:password_reset_complete' ), 'extra_context': { 'page_title': _('Changer de mot de passe'), 'button': _('Changer') }, }, name='password_reset_confirm'), # PASS RESET COMPLETE url(r'^reset/done/$', Home.as_view(), name='password_reset_complete'), ]