Commit 16a3e99f9c748a272ea3db782a0f4f7b4dc8ed5f
Committed by
Sergio Oliveira
1 parent
3cf5a06e
Exists in
master
and in
39 other branches
Create BROWSERID_ENABLED settings variable
Signed-off-by: Alexandre Barbosa <alexandreab@live.com> Signed-off-by: Lucas Kanashiro <kanashiro.duarte@gmail.com> Signed-off-by: Carlos Oliveira <carlospecter@gmail.com>
Showing
4 changed files
with
44 additions
and
29 deletions
Show diff stats
colab/accounts/urls.py
| @@ -7,45 +7,54 @@ from .views import (UserProfileDetailView, UserProfileUpdateView, LoginView, | @@ -7,45 +7,54 @@ from .views import (UserProfileDetailView, UserProfileUpdateView, LoginView, | ||
| 7 | from accounts import views | 7 | from accounts import views |
| 8 | from django.contrib.auth import views as auth_views | 8 | from django.contrib.auth import views as auth_views |
| 9 | 9 | ||
| 10 | +from colab.settings import BROWSERID_ENABLED | ||
| 11 | + | ||
| 10 | urlpatterns = patterns('', | 12 | urlpatterns = patterns('', |
| 11 | url(r'^register/$', 'colab.accounts.views.signup', name='signup'), | 13 | url(r'^register/$', 'colab.accounts.views.signup', name='signup'), |
| 12 | 14 | ||
| 13 | - url(r'^password-reset-done/?$', 'accounts.views.password_reset_done_custom', | ||
| 14 | - name="password_reset_done"), | 15 | +#FIXME Configure for XMPP |
| 16 | +# url(r'^change-password/$', | ||
| 17 | +# ChangeXMPPPasswordView.as_view(), name='change_password'), | ||
| 15 | 18 | ||
| 16 | - url(r'^password-reset-complete/$', 'accounts.views.password_reset_complete_custom', | ||
| 17 | - name="password_reset_complete"), | 19 | + url(r'^(?P<username>[\w@+.-]+)/?$', |
| 20 | + UserProfileDetailView.as_view(), name='user_profile'), | ||
| 18 | 21 | ||
| 19 | - url(r'^password-reset-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', | ||
| 20 | - auth_views.password_reset_confirm, | ||
| 21 | - {'template_name':'registration/password_reset_confirm_custom.html'}, | ||
| 22 | - name="password_reset_confirm"), | 22 | + url(r'^(?P<username>[\w@+.-]+)/edit/?$', |
| 23 | + UserProfileUpdateView.as_view(), name='user_profile_update'), | ||
| 23 | 24 | ||
| 24 | - url(r'^password-reset/?$', auth_views.password_reset, | ||
| 25 | - {'template_name':'registration/password_reset_form_custom.html'}, | ||
| 26 | - name="password_reset"), | 25 | + url(r'^(?P<username>[\w@+.-]+)/subscriptions/?$', |
| 26 | + ManageUserSubscriptionsView.as_view(), name='user_list_subscriptions'), | ||
| 27 | +) | ||
| 27 | 28 | ||
| 28 | - url(r'^change-password/?$',auth_views.password_change, | ||
| 29 | - {'template_name':'registration/password_change_form_custom.html'}, | ||
| 30 | - name='password_change'), | 29 | +if not BROWSERID_ENABLED: |
| 30 | + urlpatterns += patterns('', | ||
| 31 | + url(r'^login/?$', 'django.contrib.auth.views.login', name='login'), | ||
| 31 | 32 | ||
| 32 | - url(r'^change-password-done/?$', | ||
| 33 | - 'accounts.views.password_changed', name='password_change_done'), | 33 | + url(r'^logout/?$', 'accounts.views.logoutColab', name='logout'), |
| 34 | 34 | ||
| 35 | - url(r'^change-password/$', | ||
| 36 | - ChangeXMPPPasswordView.as_view(), name='change_password'), | 35 | + url(r'^password-reset-done/?$', 'accounts.views.password_reset_done_custom', |
| 36 | + name="password_reset_done"), | ||
| 37 | 37 | ||
| 38 | - url(r'^login/?$', LoginView.as_view(), name='login'), | ||
| 39 | -# url(r'^login/?$', 'django.contrib.auth.views.login', name='login'), | 38 | + url(r'^password-reset-complete/$', 'accounts.views.password_reset_complete_custom', |
| 39 | + name="password_reset_complete"), | ||
| 40 | 40 | ||
| 41 | -# url(r'^logout/?$', 'accounts.views.logoutColab', name='logout'), | 41 | + url(r'^password-reset-confirm/(?P<uidb64>[0-9A-Za-z]+)-(?P<token>.+)/$', |
| 42 | + auth_views.password_reset_confirm, | ||
| 43 | + {'template_name':'registration/password_reset_confirm_custom.html'}, | ||
| 44 | + name="password_reset_confirm"), | ||
| 42 | 45 | ||
| 43 | - url(r'^(?P<username>[\w@+.-]+)/?$', | ||
| 44 | - UserProfileDetailView.as_view(), name='user_profile'), | 46 | + url(r'^password-reset/?$', auth_views.password_reset, |
| 47 | + {'template_name':'registration/password_reset_form_custom.html'}, | ||
| 48 | + name="password_reset"), | ||
| 45 | 49 | ||
| 46 | - url(r'^(?P<username>[\w@+.-]+)/edit/?$', | ||
| 47 | - UserProfileUpdateView.as_view(), name='user_profile_update'), | 50 | + url(r'^change-password/?$',auth_views.password_change, |
| 51 | + {'template_name':'registration/password_change_form_custom.html'}, | ||
| 52 | + name='password_change'), | ||
| 48 | 53 | ||
| 49 | - url(r'^(?P<username>[\w@+.-]+)/subscriptions/?$', | ||
| 50 | - ManageUserSubscriptionsView.as_view(), name='user_list_subscriptions'), | ||
| 51 | -) | 54 | + url(r'^change-password-done/?$', |
| 55 | + 'accounts.views.password_changed', name='password_change_done'), | ||
| 56 | + ) | ||
| 57 | +else: | ||
| 58 | + urlpatterns += patterns('', | ||
| 59 | + url(r'^login/?$', LoginView.as_view(), name='login'), | ||
| 60 | + ) |
colab/accounts/views.py
| @@ -22,6 +22,7 @@ from haystack.query import SearchQuerySet | @@ -22,6 +22,7 @@ from haystack.query import SearchQuerySet | ||
| 22 | 22 | ||
| 23 | from colab.super_archives.models import EmailAddress, Message, EmailAddressValidation | 23 | from colab.super_archives.models import EmailAddress, Message, EmailAddressValidation |
| 24 | from colab.search.utils import trans | 24 | from colab.search.utils import trans |
| 25 | +from colab.settings import BROWSERID_ENABLED | ||
| 25 | # from proxy.trac.models import WikiCollabCount, TicketCollabCount | 26 | # from proxy.trac.models import WikiCollabCount, TicketCollabCount |
| 26 | from .forms import (UserCreationForm, ListsForm, UserUpdateForm, | 27 | from .forms import (UserCreationForm, ListsForm, UserUpdateForm, |
| 27 | ChangeXMPPPasswordForm) | 28 | ChangeXMPPPasswordForm) |
| @@ -160,7 +161,7 @@ def signup(request): | @@ -160,7 +161,7 @@ def signup(request): | ||
| 160 | 161 | ||
| 161 | user = user_form.save(commit=False) | 162 | user = user_form.save(commit=False) |
| 162 | user.needs_update = False | 163 | user.needs_update = False |
| 163 | - if not browser_id: | 164 | + if not browser_id_enabled: |
| 164 | user.is_active = False | 165 | user.is_active = False |
| 165 | EmailAddressValidation.create(user.email, user) | 166 | EmailAddressValidation.create(user.email, user) |
| 166 | 167 |
colab/management/initconfig.py
| @@ -41,6 +41,9 @@ ALLOWED_HOSTS: | @@ -41,6 +41,9 @@ ALLOWED_HOSTS: | ||
| 41 | # - example.org | 41 | # - example.org |
| 42 | # - example.net | 42 | # - example.net |
| 43 | 43 | ||
| 44 | +### Uncomment to enable Broswer ID protocol for authentication | ||
| 45 | +# BROWSERID_ENABLED: True | ||
| 46 | + | ||
| 44 | ### Uncomment to enable Converse.js | 47 | ### Uncomment to enable Converse.js |
| 45 | # CONVERSEJS_ENABLED: True | 48 | # CONVERSEJS_ENABLED: True |
| 46 | 49 |
colab/settings.py
| @@ -320,5 +320,7 @@ if FEEDZILLA_ENABLED: | @@ -320,5 +320,7 @@ if FEEDZILLA_ENABLED: | ||
| 320 | ) | 320 | ) |
| 321 | 321 | ||
| 322 | proxied_apps = locals().get('PROXIED_APPS') or {} | 322 | proxied_apps = locals().get('PROXIED_APPS') or {} |
| 323 | +BROWSERID_ENABLED = locals().get('BROWSERID_ENABLED') or False | ||
| 324 | + | ||
| 323 | for app_label in proxied_apps.keys(): | 325 | for app_label in proxied_apps.keys(): |
| 324 | INSTALLED_APPS += ('colab.proxy.{}'.format(app_label),) | 326 | INSTALLED_APPS += ('colab.proxy.{}'.format(app_label),) |