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