0002-urls-not-involved-in-registration-process-removed-fr.patch
authentic2/profile_urls.py | ||
---|---|---|
1 | 1 |
from django.conf.urls import patterns, url |
2 |
from django.contrib.auth import views as auth_views |
|
3 | ||
4 |
from authentic2.utils import get_form_class |
|
5 |
from . import app_settings |
|
6 | ||
7 |
SET_PASSWORD_FORM_CLASS = get_form_class( |
|
8 |
app_settings.A2_REGISTRATION_SET_PASSWORD_FORM_CLASS) |
|
9 |
CHANGE_PASSWORD_FORM_CLASS = get_form_class( |
|
10 |
app_settings.A2_REGISTRATION_CHANGE_PASSWORD_FORM_CLASS) |
|
2 | 11 | |
3 | 12 |
urlpatterns = patterns('authentic2.views', |
4 | 13 |
url(r'^logged-in/$', 'logged_in', name='logged-in'), |
... | ... | |
7 | 16 |
url(r'^change-email/verify/$', 'email_change_verify', |
8 | 17 |
name='email-change-verify'), |
9 | 18 |
url(r'^$', 'profile', name='account_management'), |
19 |
url(r'^password/change/$', |
|
20 |
auth_views.password_change, |
|
21 |
{'password_change_form': CHANGE_PASSWORD_FORM_CLASS}, |
|
22 |
name='auth_password_change'), |
|
23 |
url(r'^password/change/done/$', |
|
24 |
auth_views.password_change_done, |
|
25 |
name='auth_password_change_done'), |
|
26 |
url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', |
|
27 |
auth_views.password_reset_confirm, |
|
28 |
{'set_password_form': SET_PASSWORD_FORM_CLASS}, |
|
29 |
name='auth_password_reset_confirm'), |
|
30 |
url(r'^password/reset/$', |
|
31 |
auth_views.password_reset, |
|
32 |
name='auth_password_reset'), |
|
33 |
url(r'^password/reset/complete/$', |
|
34 |
auth_views.password_reset_complete, |
|
35 |
name='auth_password_reset_complete'), |
|
36 |
url(r'^password/reset/done/$', |
|
37 |
auth_views.password_reset_done, |
|
38 |
name='auth_password_reset_done'), |
|
10 | 39 |
) |
authentic2/registration_backend/urls.py | ||
---|---|---|
1 | 1 |
from django.conf.urls import patterns |
2 | 2 |
from django.conf.urls import url |
3 | 3 |
from django.utils.importlib import import_module |
4 |
from django.contrib.auth import views as auth_views |
|
5 | 4 |
from django.views.generic.base import TemplateView |
5 |
from django.contrib.auth.decorators import login_required |
|
6 | 6 | |
7 |
from authentic2.utils import get_form_class |
|
8 |
from .. import app_settings |
|
9 |
from .views import RegistrationView, ActivationView |
|
10 | ||
11 |
SET_PASSWORD_FORM_CLASS = get_form_class( |
|
12 |
app_settings.A2_REGISTRATION_SET_PASSWORD_FORM_CLASS) |
|
13 |
CHANGE_PASSWORD_FORM_CLASS = get_form_class( |
|
14 |
app_settings.A2_REGISTRATION_CHANGE_PASSWORD_FORM_CLASS) |
|
15 | ||
7 |
from .views import RegistrationView, ActivationView, DeleteView |
|
16 | 8 | |
17 | 9 |
urlpatterns = patterns('authentic2.registration_backend.views', |
18 | 10 |
url(r'^activate/complete/$', |
... | ... | |
34 | 26 |
url(r'^register/closed/$', |
35 | 27 |
TemplateView.as_view(template_name='registration/registration_closed.html'), |
36 | 28 |
name='registration_disallowed'), |
37 |
url(r'^password/change/$', |
|
38 |
auth_views.password_change, |
|
39 |
{'password_change_form': CHANGE_PASSWORD_FORM_CLASS}, |
|
40 |
name='auth_password_change'), |
|
41 |
url(r'^password/change/done/$', |
|
42 |
auth_views.password_change_done, |
|
43 |
name='auth_password_change_done'), |
|
44 |
url(r'^password/reset/confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$', |
|
45 |
auth_views.password_reset_confirm, |
|
46 |
{'set_password_form': SET_PASSWORD_FORM_CLASS}, |
|
47 |
name='auth_password_reset_confirm'), |
|
48 | 29 |
url(r'^delete/$', |
49 |
'delete',
|
|
30 |
login_required(DeleteView.as_view()),
|
|
50 | 31 |
name='delete_account'), |
51 |
url(r'^password/reset/$', |
|
52 |
auth_views.password_reset, |
|
53 |
name='auth_password_reset'), |
|
54 |
url(r'^password/reset/complete/$', |
|
55 |
auth_views.password_reset_complete, |
|
56 |
name='auth_password_reset_complete'), |
|
57 |
url(r'^password/reset/done/$', |
|
58 |
auth_views.password_reset_done, |
|
59 |
name='auth_password_reset_done'), |
|
60 | 32 |
) |
authentic2/registration_backend/views.py | ||
---|---|---|
4 | 4 |
from django.shortcuts import redirect, render |
5 | 5 |
from django.utils.translation import ugettext as _ |
6 | 6 |
from django.contrib import messages |
7 |
from django.contrib.auth.decorators import login_required |
|
8 | 7 |
from django.contrib.sites.models import Site, RequestSite |
9 | 8 |
from django.contrib.auth.models import BaseUserManager, Group |
10 | 9 |
from django.conf import settings |
... | ... | |
104 | 103 |
new_user.groups = groups |
105 | 104 |
return new_user |
106 | 105 | |
107 |
@login_required |
|
108 |
def delete(request, next_url='/'): |
|
109 |
next_url = request.build_absolute_uri(request.META.get('HTTP_REFERER') or next_url) |
|
110 |
if not app_settings.A2_REGISTRATION_CAN_DELETE_ACCOUNT: |
|
111 |
return redirect(next_url) |
|
112 |
if request.method == 'POST': |
|
106 |
class DeleteView(TemplateView): |
|
107 |
def get(self, request, *args, **kwargs): |
|
108 |
next_url = request.build_absolute_uri(request.META.get('HTTP_REFERER')\ |
|
109 |
or request.GET.get('next_url')) |
|
110 |
if not app_settings.A2_REGISTRATION_CAN_DELETE_ACCOUNT: |
|
111 |
return redirect(next_url) |
|
112 |
return render(request, 'registration/delete_account.html') |
|
113 | ||
114 |
def post(self, request, *args, **kwargs): |
|
115 |
next_url = request.build_absolute_uri(request.META.get('HTTP_REFERER')\ |
|
116 |
or request.GET.get('next_url')) |
|
113 | 117 |
if 'submit' in request.POST: |
114 | 118 |
models.DeletedUser.objects.delete_user(request.user) |
115 | 119 |
logger.info(u'deletion of account %s requested' % request.user) |
... | ... | |
117 | 121 |
return redirect('auth_logout') |
118 | 122 |
else: |
119 | 123 |
return redirect(next_url) |
120 |
return render(request, 'registration/delete_account.html') |
|
121 |
- |