Show More
@@ -41,8 +41,10 b' except ImportError:' | |||
|
41 | 41 | |
|
42 | 42 | class AuthenticatedHandler(web.RequestHandler): |
|
43 | 43 | """A RequestHandler with an authenticated user.""" |
|
44 | ||
|
44 | 45 | def get_current_user(self): |
|
45 | 46 | user_id = self.get_secure_cookie("user") |
|
47 | # For now the user_id should not return empty, but it could eventually | |
|
46 | 48 | if user_id == '': |
|
47 | 49 | user_id = 'anonymous' |
|
48 | 50 | if user_id is None: |
@@ -54,6 +56,7 b' class AuthenticatedHandler(web.RequestHandler):' | |||
|
54 | 56 | |
|
55 | 57 | |
|
56 | 58 | class NBBrowserHandler(AuthenticatedHandler): |
|
59 | ||
|
57 | 60 | @web.authenticated |
|
58 | 61 | def get(self): |
|
59 | 62 | nbm = self.application.notebook_manager |
@@ -61,10 +64,11 b' class NBBrowserHandler(AuthenticatedHandler):' | |||
|
61 | 64 | self.render('nbbrowser.html', project=project, |
|
62 | 65 | base_project_url=u'/', base_kernel_url=u'/') |
|
63 | 66 | |
|
67 | ||
|
64 | 68 | class LoginHandler(AuthenticatedHandler): |
|
69 | ||
|
65 | 70 | def get(self): |
|
66 | user_id = self.get_secure_cookie("user") or '' | |
|
67 | self.render('login.html', user_id=user_id) | |
|
71 | self.render('login.html') | |
|
68 | 72 | |
|
69 | 73 | def post(self): |
|
70 | 74 | pwd = self.get_argument("password", default=u'') |
@@ -73,7 +77,9 b' class LoginHandler(AuthenticatedHandler):' | |||
|
73 | 77 | url = self.get_argument("next", default="/") |
|
74 | 78 | self.redirect(url) |
|
75 | 79 | |
|
80 | ||
|
76 | 81 | class NewHandler(AuthenticatedHandler): |
|
82 | ||
|
77 | 83 | @web.authenticated |
|
78 | 84 | def get(self): |
|
79 | 85 | notebook_id = self.application.notebook_manager.new_notebook() |
@@ -82,6 +88,7 b' class NewHandler(AuthenticatedHandler):' | |||
|
82 | 88 | |
|
83 | 89 | |
|
84 | 90 | class NamedNotebookHandler(AuthenticatedHandler): |
|
91 | ||
|
85 | 92 | @web.authenticated |
|
86 | 93 | def get(self, notebook_id): |
|
87 | 94 | nbm = self.application.notebook_manager |
General Comments 0
You need to be logged in to leave comments.
Login now