Commit 10c867505d3ebcc992091f9d49b277290f1bf3f4
1 parent
e47dec59
Exists in
master
and in
39 other branches
Adding browserid login
Showing
5 changed files
with
31 additions
and
10 deletions
Show diff stats
requirements.txt
src/colab/custom_settings.py
@@ -21,6 +21,7 @@ INSTALLED_APPS = INSTALLED_APPS + ( | @@ -21,6 +21,7 @@ INSTALLED_APPS = INSTALLED_APPS + ( | ||
21 | 'raven.contrib.django.raven_compat', | 21 | 'raven.contrib.django.raven_compat', |
22 | 'south', | 22 | 'south', |
23 | 'cliauth', | 23 | 'cliauth', |
24 | + 'django_browserid', | ||
24 | 25 | ||
25 | # Own apps | 26 | # Own apps |
26 | 'super_archives', | 27 | 'super_archives', |
@@ -109,6 +110,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( | @@ -109,6 +110,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( | ||
109 | 'django.core.context_processors.tz', | 110 | 'django.core.context_processors.tz', |
110 | 'django.contrib.messages.context_processors.messages', | 111 | 'django.contrib.messages.context_processors.messages', |
111 | 'django.core.context_processors.request', | 112 | 'django.core.context_processors.request', |
113 | + 'django_browserid.context_processors.browserid', | ||
112 | ) | 114 | ) |
113 | 115 | ||
114 | MIDDLEWARE_CLASSES = ( | 116 | MIDDLEWARE_CLASSES = ( |
@@ -121,6 +123,13 @@ MIDDLEWARE_CLASSES = ( | @@ -121,6 +123,13 @@ MIDDLEWARE_CLASSES = ( | ||
121 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', | 123 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', |
122 | ) | 124 | ) |
123 | 125 | ||
126 | +# Add the django_browserid authentication backend. | ||
127 | +AUTHENTICATION_BACKENDS = ( | ||
128 | + 'django_browserid.auth.BrowserIDBackend', | ||
129 | +) | ||
130 | + | ||
131 | + | ||
132 | + | ||
124 | SOCKS_SERVER = None | 133 | SOCKS_SERVER = None |
125 | SOCKS_PORT = None | 134 | SOCKS_PORT = None |
126 | 135 |
src/colab/deprecated/templates/base.html
1 | {% load i18n %} | 1 | {% load i18n %} |
2 | +{% load browserid %} | ||
2 | <html> | 3 | <html> |
3 | <head> | 4 | <head> |
4 | 5 | ||
@@ -72,29 +73,24 @@ | @@ -72,29 +73,24 @@ | ||
72 | </head> | 73 | </head> |
73 | 74 | ||
74 | <body class="container"> | 75 | <body class="container"> |
76 | + {% browserid_info %} | ||
75 | <div id="header" class="span-24"> | 77 | <div id="header" class="span-24"> |
76 | <div id="top-menu" class="right"> | 78 | <div id="top-menu" class="right"> |
77 | {% if not user.is_authenticated %} | 79 | {% if not user.is_authenticated %} |
78 | <span class="colborder"> | 80 | <span class="colborder"> |
79 | - <a href="{% url 'signup' %}">{% trans "Sign up" %}</a> | ||
80 | - </span> | ||
81 | - <span> | ||
82 | - <a href="{% url 'login' %}?next={{ request.path }}">{% trans "Login" %}</a> | 81 | + <a href="{% url 'signup' %}">{% trans "Register" %}</a> |
83 | </span> | 82 | </span> |
83 | + {% browserid_login text='Login' %} | ||
84 | {% else %} | 84 | {% else %} |
85 | <span class="colborder"> | 85 | <span class="colborder"> |
86 | - {% trans "authenticated as" %} <b>{{ user.username }}</b> | 86 | + {% trans "authenticated as" %} <b>{{ user.email }}</b> |
87 | </span> | 87 | </span> |
88 | <span class="colborder"> | 88 | <span class="colborder"> |
89 | <a href="{% url 'user_profile' user.username %}"> | 89 | <a href="{% url 'user_profile' user.username %}"> |
90 | {% trans "My Profile" %} | 90 | {% trans "My Profile" %} |
91 | </a> | 91 | </a> |
92 | </span> | 92 | </span> |
93 | - <span> | ||
94 | - <a href="{% url 'logout' %}"> | ||
95 | - {% trans "Logout" %} | ||
96 | - </a> | ||
97 | - </span> | 93 | + {% browserid_logout text='Logout '%} |
98 | {% endif %} | 94 | {% endif %} |
99 | </div> | 95 | </div> |
100 | 96 | ||
@@ -175,6 +171,7 @@ | @@ -175,6 +171,7 @@ | ||
175 | }); | 171 | }); |
176 | }); | 172 | }); |
177 | </script> | 173 | </script> |
174 | + {% browserid_js %} | ||
178 | 175 | ||
179 | 176 | ||
180 | </body> | 177 | </body> |
src/colab/local_settings-dev.py
@@ -18,3 +18,13 @@ SECRET_KEY = ')(jksdfhsjkadfhjkh234ns!8fqu-1186h$vuj' | @@ -18,3 +18,13 @@ SECRET_KEY = ')(jksdfhsjkadfhjkh234ns!8fqu-1186h$vuj' | ||
18 | #SOCKS_SERVER = '127.0.0.1' | 18 | #SOCKS_SERVER = '127.0.0.1' |
19 | #SOCKS_PORT = 9050 | 19 | #SOCKS_PORT = 9050 |
20 | 20 | ||
21 | +SITE_URL = 'http://localhost:8000' | ||
22 | + | ||
23 | +# Path to redirect to on successful login. | ||
24 | +LOGIN_REDIRECT_URL = '/' | ||
25 | + | ||
26 | +# Path to redirect to on unsuccessful login attempt. | ||
27 | +LOGIN_REDIRECT_URL_FAILURE = '/' | ||
28 | + | ||
29 | +# Path to redirect to on logout. | ||
30 | +LOGOUT_REDIRECT_URL = '/' |
src/colab/urls.py
@@ -53,6 +53,8 @@ urlpatterns = patterns('', | @@ -53,6 +53,8 @@ urlpatterns = patterns('', | ||
53 | {'next_page': '/'}, name='logout'), | 53 | {'next_page': '/'}, name='logout'), |
54 | 54 | ||
55 | url(r'^planet/', include('feedzilla.urls')), | 55 | url(r'^planet/', include('feedzilla.urls')), |
56 | + | ||
57 | + (r'^browserid/', include('django_browserid.urls')), | ||
56 | 58 | ||
57 | # Uncomment the next line to enable the admin: | 59 | # Uncomment the next line to enable the admin: |
58 | url(r'^colab/admin/', include(admin.site.urls)), | 60 | url(r'^colab/admin/', include(admin.site.urls)), |