##// END OF EJS Templates
allows password and prefix for notebook...
Matthias BUSSONNIER -
Show More
@@ -208,7 +208,7 class LoginHandler(AuthenticatedHandler):
208 208
209 209 def _render(self, message=None):
210 210 self.render('login.html',
211 next=self.get_argument('next', default='/'),
211 next=self.get_argument('next', default=self.application.ipython_app.base_project_url),
212 212 read_only=self.read_only,
213 213 logged_in=self.logged_in,
214 214 login_available=self.login_available,
@@ -218,7 +218,7 class LoginHandler(AuthenticatedHandler):
218 218
219 219 def get(self):
220 220 if self.current_user:
221 self.redirect(self.get_argument('next', default='/'))
221 self.redirect(self.get_argument('next', default=self.application.ipython_app.base_project_url))
222 222 else:
223 223 self._render()
224 224
@@ -231,7 +231,7 class LoginHandler(AuthenticatedHandler):
231 231 self._render(message={'error': 'Invalid password'})
232 232 return
233 233
234 self.redirect(self.get_argument('next', default='/'))
234 self.redirect(self.get_argument('next', default=self.application.ipython_app.base_project_url))
235 235
236 236
237 237 class LogoutHandler(AuthenticatedHandler):
@@ -140,15 +140,6 class NotebookWebApplication(web.Application):
140 140 (r"/clusters/%s/%s" % (_profile_regex, _cluster_action_regex), ClusterActionHandler),
141 141 (r"/clusters/%s" % _profile_regex, ClusterProfileHandler),
142 142 ]
143 settings = dict(
144 template_path=os.path.join(os.path.dirname(__file__), "templates"),
145 static_path=os.path.join(os.path.dirname(__file__), "static"),
146 cookie_secret=os.urandom(1024),
147 login_url="/login",
148 )
149
150 # allow custom overrides for the tornado web app.
151 settings.update(settings_overrides)
152 143
153 144 # Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and
154 145 # base_project_url will always be unicode, which will in turn
@@ -160,6 +151,16 class NotebookWebApplication(web.Application):
160 151 # and thus guaranteed to be ASCII: 'héllo' is really 'h%C3%A9llo'.
161 152 base_project_url = py3compat.unicode_to_str(base_project_url, 'ascii')
162 153
154 settings = dict(
155 template_path=os.path.join(os.path.dirname(__file__), "templates"),
156 static_path=os.path.join(os.path.dirname(__file__), "static"),
157 cookie_secret=os.urandom(1024),
158 login_url="%s/login"%(base_project_url.rstrip('/')),
159 )
160
161 # allow custom overrides for the tornado web app.
162 settings.update(settings_overrides)
163
163 164 # prepend base_project_url onto the patterns that we match
164 165 new_handlers = []
165 166 for handler in handlers:
@@ -29,10 +29,10 var IPython = (function (IPython) {
29 29 LoginWidget.prototype.bind_events = function () {
30 30 var that = this;
31 31 this.element.find("button#logout").click(function () {
32 window.location = "/logout";
32 window.location = "logout";
33 33 });
34 34 this.element.find("button#login").click(function () {
35 window.location = "/login";
35 window.location = "login";
36 36 });
37 37 };
38 38
@@ -16,7 +16,7
16 16 <div id="main_app">
17 17
18 18 {% if login_available %}
19 <form action="/login?next={{url_escape(next)}}" method="post">
19 <form action="login?next={{url_escape(next)}}" method="post">
20 20 Password: <input type="password" class='ui-widget ui-widget-content' name="password" id="password_input">
21 21 <input type="submit" value="Log in" id="login_submit">
22 22 </form>
@@ -23,9 +23,9
23 23 {% end %}
24 24
25 25 {% if read_only or not login_available %}
26 Proceed to the <a href="/">dashboard</a>.
26 Proceed to the <a href="">dashboard</a>.
27 27 {% else %}
28 Proceed to the <a href="/login">login page</a>.
28 Proceed to the <a href="login">login page</a>.
29 29 {% end %}
30 30
31 31
General Comments 0
You need to be logged in to leave comments. Login now