Show More
@@ -208,7 +208,7 b' class LoginHandler(AuthenticatedHandler):' | |||||
208 |
|
208 | |||
209 | def _render(self, message=None): |
|
209 | def _render(self, message=None): | |
210 | self.render('login.html', |
|
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 | read_only=self.read_only, |
|
212 | read_only=self.read_only, | |
213 | logged_in=self.logged_in, |
|
213 | logged_in=self.logged_in, | |
214 | login_available=self.login_available, |
|
214 | login_available=self.login_available, | |
@@ -218,7 +218,7 b' class LoginHandler(AuthenticatedHandler):' | |||||
218 |
|
218 | |||
219 | def get(self): |
|
219 | def get(self): | |
220 | if self.current_user: |
|
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 | else: |
|
222 | else: | |
223 | self._render() |
|
223 | self._render() | |
224 |
|
224 | |||
@@ -231,7 +231,7 b' class LoginHandler(AuthenticatedHandler):' | |||||
231 | self._render(message={'error': 'Invalid password'}) |
|
231 | self._render(message={'error': 'Invalid password'}) | |
232 | return |
|
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 | class LogoutHandler(AuthenticatedHandler): |
|
237 | class LogoutHandler(AuthenticatedHandler): |
@@ -140,15 +140,6 b' class NotebookWebApplication(web.Application):' | |||||
140 | (r"/clusters/%s/%s" % (_profile_regex, _cluster_action_regex), ClusterActionHandler), |
|
140 | (r"/clusters/%s/%s" % (_profile_regex, _cluster_action_regex), ClusterActionHandler), | |
141 | (r"/clusters/%s" % _profile_regex, ClusterProfileHandler), |
|
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 | # Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and |
|
144 | # Python < 2.6.5 doesn't accept unicode keys in f(**kwargs), and | |
154 | # base_project_url will always be unicode, which will in turn |
|
145 | # base_project_url will always be unicode, which will in turn | |
@@ -160,6 +151,16 b' class NotebookWebApplication(web.Application):' | |||||
160 | # and thus guaranteed to be ASCII: 'héllo' is really 'h%C3%A9llo'. |
|
151 | # and thus guaranteed to be ASCII: 'héllo' is really 'h%C3%A9llo'. | |
161 | base_project_url = py3compat.unicode_to_str(base_project_url, 'ascii') |
|
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 | # prepend base_project_url onto the patterns that we match |
|
164 | # prepend base_project_url onto the patterns that we match | |
164 | new_handlers = [] |
|
165 | new_handlers = [] | |
165 | for handler in handlers: |
|
166 | for handler in handlers: |
@@ -10,6 +10,7 b'' | |||||
10 | //============================================================================ |
|
10 | //============================================================================ | |
11 |
|
11 | |||
12 | var IPython = (function (IPython) { |
|
12 | var IPython = (function (IPython) { | |
|
13 | var base_url = $('body').data('baseProjectUrl'); | |||
13 |
|
14 | |||
14 | var LoginWidget = function (selector) { |
|
15 | var LoginWidget = function (selector) { | |
15 | this.selector = selector; |
|
16 | this.selector = selector; | |
@@ -29,10 +30,10 b' var IPython = (function (IPython) {' | |||||
29 | LoginWidget.prototype.bind_events = function () { |
|
30 | LoginWidget.prototype.bind_events = function () { | |
30 | var that = this; |
|
31 | var that = this; | |
31 | this.element.find("button#logout").click(function () { |
|
32 | this.element.find("button#logout").click(function () { | |
32 |
window.location = " |
|
33 | window.location = base_url+"logout"; | |
33 | }); |
|
34 | }); | |
34 | this.element.find("button#login").click(function () { |
|
35 | this.element.find("button#login").click(function () { | |
35 |
window.location = " |
|
36 | window.location = base_url+"login"; | |
36 | }); |
|
37 | }); | |
37 | }; |
|
38 | }; | |
38 |
|
39 |
@@ -16,7 +16,7 b'' | |||||
16 | <div id="main_app"> |
|
16 | <div id="main_app"> | |
17 |
|
17 | |||
18 | {% if login_available %} |
|
18 | {% if login_available %} | |
19 |
<form action=" |
|
19 | <form action="{{base_project_url}}login?next={{url_escape(next)}}" method="post"> | |
20 | Password: <input type="password" class='ui-widget ui-widget-content' name="password" id="password_input"> |
|
20 | Password: <input type="password" class='ui-widget ui-widget-content' name="password" id="password_input"> | |
21 | <input type="submit" value="Log in" id="login_submit"> |
|
21 | <input type="submit" value="Log in" id="login_submit"> | |
22 | </form> |
|
22 | </form> |
@@ -23,9 +23,9 b'' | |||||
23 | {% end %} |
|
23 | {% end %} | |
24 |
|
24 | |||
25 | {% if read_only or not login_available %} |
|
25 | {% if read_only or not login_available %} | |
26 |
Proceed to the <a href=" |
|
26 | Proceed to the <a href="{{base_project_url}}">dashboard</a>. | |
27 | {% else %} |
|
27 | {% else %} | |
28 |
Proceed to the <a href=" |
|
28 | Proceed to the <a href="{{base_project_url}}login">login page</a>. | |
29 | {% end %} |
|
29 | {% end %} | |
30 |
|
30 | |||
31 |
|
31 |
General Comments 0
You need to be logged in to leave comments.
Login now