Show More
@@ -146,13 +146,13 b' class AuthenticatedHandler(RequestHandler):' | |||
|
146 | 146 | """A RequestHandler with an authenticated user.""" |
|
147 | 147 | |
|
148 | 148 | def get_current_user(self): |
|
149 |
user_id = self.get_secure_cookie( |
|
|
149 | user_id = self.get_secure_cookie(self.settings['cookie_name']) | |
|
150 | 150 | # For now the user_id should not return empty, but it could eventually |
|
151 | 151 | if user_id == '': |
|
152 | 152 | user_id = 'anonymous' |
|
153 | 153 | if user_id is None: |
|
154 | 154 | # prevent extra Invalid cookie sig warnings: |
|
155 |
self.clear_cookie(' |
|
|
155 | self.clear_cookie(self.settings['cookie_name']) | |
|
156 | 156 | if not self.application.password and not self.application.read_only: |
|
157 | 157 | user_id = 'anonymous' |
|
158 | 158 | return user_id |
@@ -242,7 +242,7 b' class LoginHandler(AuthenticatedHandler):' | |||
|
242 | 242 | pwd = self.get_argument('password', default=u'') |
|
243 | 243 | if self.application.password: |
|
244 | 244 | if passwd_check(self.application.password, pwd): |
|
245 |
self.set_secure_cookie(' |
|
|
245 | self.set_secure_cookie(self.settings['cookie_name'], str(uuid.uuid4())) | |
|
246 | 246 | else: |
|
247 | 247 | self._render(message={'error': 'Invalid password'}) |
|
248 | 248 | return |
@@ -253,7 +253,7 b' class LoginHandler(AuthenticatedHandler):' | |||
|
253 | 253 | class LogoutHandler(AuthenticatedHandler): |
|
254 | 254 | |
|
255 | 255 | def get(self): |
|
256 |
self.clear_cookie(' |
|
|
256 | self.clear_cookie(self.settings['cookie_name']) | |
|
257 | 257 | if self.login_available: |
|
258 | 258 | message = {'info': 'Successfully logged out.'} |
|
259 | 259 | else: |
@@ -427,7 +427,7 b' class AuthenticatedZMQStreamHandler(ZMQStreamHandler):' | |||
|
427 | 427 | self.on_message = self.on_first_message |
|
428 | 428 | |
|
429 | 429 | def get_current_user(self): |
|
430 |
user_id = self.get_secure_cookie( |
|
|
430 | user_id = self.get_secure_cookie(self.settings['cookie_name']) | |
|
431 | 431 | if user_id == '' or (user_id is None and not self.application.password): |
|
432 | 432 | user_id = 'anonymous' |
|
433 | 433 | return user_id |
@@ -28,6 +28,7 b' import socket' | |||
|
28 | 28 | import sys |
|
29 | 29 | import threading |
|
30 | 30 | import time |
|
31 | import uuid | |
|
31 | 32 | import webbrowser |
|
32 | 33 | |
|
33 | 34 | # Third party |
@@ -164,6 +165,7 b' class NotebookWebApplication(web.Application):' | |||
|
164 | 165 | static_handler_class = FileFindHandler, |
|
165 | 166 | cookie_secret=os.urandom(1024), |
|
166 | 167 | login_url="%s/login"%(base_project_url.rstrip('/')), |
|
168 | cookie_name='username-%s' % uuid.uuid4(), | |
|
167 | 169 | ) |
|
168 | 170 | |
|
169 | 171 | # allow custom overrides for the tornado web app. |
General Comments 0
You need to be logged in to leave comments.
Login now