2017-02-20 18:42:37 +01:00
|
|
|
from django.conf.urls import url
|
2017-02-18 01:45:22 +01:00
|
|
|
from django.contrib.auth import views as auth_views
|
2018-08-27 00:30:12 +02:00
|
|
|
from django.urls import reverse_lazy
|
2017-05-16 20:20:38 +02:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2017-02-21 16:02:23 +01:00
|
|
|
from shared.views import Home
|
2017-02-21 16:56:34 +01:00
|
|
|
from users.views import CreateUser
|
2017-02-18 01:45:22 +01:00
|
|
|
|
2017-02-21 16:56:34 +01:00
|
|
|
app_name = 'users'
|
2017-02-18 01:45:22 +01:00
|
|
|
urlpatterns = [
|
|
|
|
# CREATE USER
|
2017-02-21 19:12:18 +01:00
|
|
|
url(r'^create/$', CreateUser.as_view(), name='create_user'),
|
2017-02-18 01:45:22 +01:00
|
|
|
# LOGIN
|
2017-02-21 19:12:18 +01:00
|
|
|
url(r'^login/$',
|
2017-02-18 01:45:22 +01:00
|
|
|
auth_views.login,
|
2017-02-21 16:56:34 +01:00
|
|
|
{'template_name': 'users/login.html',
|
2017-02-20 18:42:37 +01:00
|
|
|
'extra_context': {
|
2017-05-16 20:20:38 +02:00
|
|
|
'page_title': _('Connexion'),
|
|
|
|
'button': _('Se connecter'),
|
2017-02-20 18:42:37 +01:00
|
|
|
},
|
|
|
|
},
|
2017-02-18 01:45:22 +01:00
|
|
|
name='login',
|
2017-02-20 18:42:37 +01:00
|
|
|
),
|
2017-02-18 01:45:22 +01:00
|
|
|
# LOGOUT
|
2017-02-21 19:12:18 +01:00
|
|
|
url(r'^logout/$',
|
2017-02-18 01:45:22 +01:00
|
|
|
auth_views.logout,
|
|
|
|
name='logout',),
|
|
|
|
# PASSWORD_CHANGE
|
2017-02-21 19:12:18 +01:00
|
|
|
url(r'^password_change/$',
|
2017-02-18 01:45:22 +01:00
|
|
|
auth_views.password_change,
|
2017-02-21 16:56:34 +01:00
|
|
|
{'template_name': 'users/change_pass.html',
|
2017-02-21 16:02:23 +01:00
|
|
|
'post_change_redirect': reverse_lazy('shared:home'),
|
2017-02-20 18:42:37 +01:00
|
|
|
'extra_context': {
|
2017-05-16 20:20:38 +02:00
|
|
|
'page_title': _('Changement de mot de passe'),
|
|
|
|
'button': _('Modifier'),
|
2017-02-20 18:42:37 +01:00
|
|
|
},
|
|
|
|
},
|
2017-02-18 01:45:22 +01:00
|
|
|
name='password_change'),
|
|
|
|
# url('^password_change/done/$', name='password_change_done'),
|
|
|
|
# RESET PASSWORD
|
2017-02-21 19:12:18 +01:00
|
|
|
url(r'^password_reset/$',
|
2017-02-18 01:45:22 +01:00
|
|
|
auth_views.password_reset,
|
2017-02-21 16:56:34 +01:00
|
|
|
{'template_name': 'users/password_reset.html',
|
2017-02-20 18:42:37 +01:00
|
|
|
'email_template_name': 'email_password_reset.html',
|
|
|
|
'subject_template_name': 'subject_password_reset.txt',
|
2017-02-21 16:56:34 +01:00
|
|
|
'post_reset_redirect': reverse_lazy('users:password_reset_done'),
|
2017-02-20 18:42:37 +01:00
|
|
|
'extra_context': {
|
2017-05-16 20:20:38 +02:00
|
|
|
'page_title': _('Demander un nouveau mot de passe'),
|
|
|
|
'button': _('Envoyer')
|
2017-02-20 18:42:37 +01:00
|
|
|
},
|
|
|
|
},
|
2017-02-18 01:45:22 +01:00
|
|
|
name='password_reset'),
|
|
|
|
# PASS RESET DONE
|
2017-02-21 19:12:18 +01:00
|
|
|
url(r'^password_reset/done/$',
|
2017-02-21 16:02:23 +01:00
|
|
|
Home.as_view(),
|
2017-02-18 01:45:22 +01:00
|
|
|
name='password_reset_done'),
|
|
|
|
# PASS RESET CONFIRM
|
2017-04-26 21:36:22 +02:00
|
|
|
url('^reset/(?P<uidb64>[0-9A-Za-z_\-]+)/'
|
|
|
|
'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$',
|
2017-02-18 01:45:22 +01:00
|
|
|
auth_views.password_reset_confirm,
|
|
|
|
{
|
2017-02-20 18:42:37 +01:00
|
|
|
'template_name': 'user/user_form.html',
|
2017-04-26 21:36:22 +02:00
|
|
|
'post_reset_redirect': reverse_lazy(
|
|
|
|
'user:password_reset_complete'
|
|
|
|
),
|
2017-02-20 18:42:37 +01:00
|
|
|
'extra_context': {
|
2017-05-16 20:20:38 +02:00
|
|
|
'page_title': _('Changer de mot de passe'),
|
|
|
|
'button': _('Changer')
|
2017-02-20 18:42:37 +01:00
|
|
|
},
|
|
|
|
},
|
2017-02-18 01:45:22 +01:00
|
|
|
name='password_reset_confirm'),
|
|
|
|
# PASS RESET COMPLETE
|
2017-02-21 19:12:18 +01:00
|
|
|
url(r'^reset/done/$',
|
2017-02-21 16:02:23 +01:00
|
|
|
Home.as_view(),
|
2017-02-18 01:45:22 +01:00
|
|
|
name='password_reset_complete'),
|
|
|
|
]
|