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 | 21 | 'raven.contrib.django.raven_compat', |
22 | 22 | 'south', |
23 | 23 | 'cliauth', |
24 | + 'django_browserid', | |
24 | 25 | |
25 | 26 | # Own apps |
26 | 27 | 'super_archives', |
... | ... | @@ -109,6 +110,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( |
109 | 110 | 'django.core.context_processors.tz', |
110 | 111 | 'django.contrib.messages.context_processors.messages', |
111 | 112 | 'django.core.context_processors.request', |
113 | + 'django_browserid.context_processors.browserid', | |
112 | 114 | ) |
113 | 115 | |
114 | 116 | MIDDLEWARE_CLASSES = ( |
... | ... | @@ -121,6 +123,13 @@ MIDDLEWARE_CLASSES = ( |
121 | 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 | 133 | SOCKS_SERVER = None |
125 | 134 | SOCKS_PORT = None |
126 | 135 | ... | ... |
src/colab/deprecated/templates/base.html
1 | 1 | {% load i18n %} |
2 | +{% load browserid %} | |
2 | 3 | <html> |
3 | 4 | <head> |
4 | 5 | |
... | ... | @@ -72,29 +73,24 @@ |
72 | 73 | </head> |
73 | 74 | |
74 | 75 | <body class="container"> |
76 | + {% browserid_info %} | |
75 | 77 | <div id="header" class="span-24"> |
76 | 78 | <div id="top-menu" class="right"> |
77 | 79 | {% if not user.is_authenticated %} |
78 | 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 | 82 | </span> |
83 | + {% browserid_login text='Login' %} | |
84 | 84 | {% else %} |
85 | 85 | <span class="colborder"> |
86 | - {% trans "authenticated as" %} <b>{{ user.username }}</b> | |
86 | + {% trans "authenticated as" %} <b>{{ user.email }}</b> | |
87 | 87 | </span> |
88 | 88 | <span class="colborder"> |
89 | 89 | <a href="{% url 'user_profile' user.username %}"> |
90 | 90 | {% trans "My Profile" %} |
91 | 91 | </a> |
92 | 92 | </span> |
93 | - <span> | |
94 | - <a href="{% url 'logout' %}"> | |
95 | - {% trans "Logout" %} | |
96 | - </a> | |
97 | - </span> | |
93 | + {% browserid_logout text='Logout '%} | |
98 | 94 | {% endif %} |
99 | 95 | </div> |
100 | 96 | |
... | ... | @@ -175,6 +171,7 @@ |
175 | 171 | }); |
176 | 172 | }); |
177 | 173 | </script> |
174 | + {% browserid_js %} | |
178 | 175 | |
179 | 176 | |
180 | 177 | </body> | ... | ... |
src/colab/local_settings-dev.py
... | ... | @@ -18,3 +18,13 @@ SECRET_KEY = ')(jksdfhsjkadfhjkh234ns!8fqu-1186h$vuj' |
18 | 18 | #SOCKS_SERVER = '127.0.0.1' |
19 | 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 | 53 | {'next_page': '/'}, name='logout'), |
54 | 54 | |
55 | 55 | url(r'^planet/', include('feedzilla.urls')), |
56 | + | |
57 | + (r'^browserid/', include('django_browserid.urls')), | |
56 | 58 | |
57 | 59 | # Uncomment the next line to enable the admin: |
58 | 60 | url(r'^colab/admin/', include(admin.site.urls)), | ... | ... |