##// END OF EJS Templates
Simplifying logic on login page.
Brian E. Granger -
Show More
@@ -0,0 +1,29 b''
1 //----------------------------------------------------------------------------
2 // Copyright (C) 2008-2011 The IPython Development Team
3 //
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
7
8 //============================================================================
9 // On document ready
10 //============================================================================
11
12
13 $(document).ready(function () {
14
15 $('div#header').addClass('border-box-sizing');
16 $('div#header_border').addClass('border-box-sizing ui-widget ui-widget-content');
17
18 $('div#main_app').addClass('border-box-sizing ui-widget');
19 $('div#app_hbox').addClass('hbox');
20
21 $('div#left_panel').addClass('box-flex');
22 $('div#right_panel').addClass('box-flex');
23
24 // These have display: none in the css file and are made visible here to prevent FLOUC.
25 $('div#header').css('display','block');
26 $('div#main_app').css('display','block');
27
28 });
29
@@ -70,13 +70,13 b' class NBBrowserHandler(AuthenticatedHandler):'
70 class LoginHandler(AuthenticatedHandler):
70 class LoginHandler(AuthenticatedHandler):
71
71
72 def get(self):
72 def get(self):
73 self.render('login.html')
73 self.render('login.html', next='/')
74
74
75 def post(self):
75 def post(self):
76 pwd = self.get_argument("password", default=u'')
76 pwd = self.get_argument('password', default=u'')
77 if self.application.password and pwd == self.application.password:
77 if self.application.password and pwd == self.application.password:
78 self.set_secure_cookie("user", str(uuid.uuid4()))
78 self.set_secure_cookie('user', str(uuid.uuid4()))
79 url = self.get_argument("next", default="/")
79 url = self.get_argument('next', default='/')
80 self.redirect(url)
80 self.redirect(url)
81
81
82
82
@@ -10,18 +10,10 b''
10 <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" />
10 <link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" />
11 <link rel="stylesheet" href="static/css/layout.css" type="text/css" />
11 <link rel="stylesheet" href="static/css/layout.css" type="text/css" />
12 <link rel="stylesheet" href="static/css/base.css" type="text/css" />
12 <link rel="stylesheet" href="static/css/base.css" type="text/css" />
13 <script type="text/javascript" charset="utf-8">
13
14 function add_next_to_action(){
15 // add 'next' argument to action url, to preserve redirect
16 var query = location.search.substring(1);
17 var form = document.forms[0];
18 var action = form.getAttribute("action");
19 form.setAttribute("action", action + '?' + query);
20 }
21 </script>
22 </head>
14 </head>
23
15
24 <body onload="add_next_to_action()">
16 <body>
25
17
26 <div id="header">
18 <div id="header">
27 <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
19 <span id="ipython_notebook"><h1>IPython Notebook</h1></span>
@@ -37,7 +29,7 b''
37 </div>
29 </div>
38
30
39 <div id="content_panel">
31 <div id="content_panel">
40 <form action="/login" method="post">
32 <form action="/login?next={{url_escape(next)}}" method="post">
41 Password: <input type="password" name="password">
33 Password: <input type="password" name="password">
42 <input type="submit" value="Sign in">
34 <input type="submit" value="Sign in">
43 </form>
35 </form>
@@ -52,8 +44,7 b''
52 <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script>
44 <script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script>
53 <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script>
45 <script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script>
54 <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script>
46 <script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script>
55 <script src="static/js/notebooklist.js" type="text/javascript" charset="utf-8"></script>
47 <script src="static/js/login_main.js" type="text/javascript" charset="utf-8"></script>
56 <script src="static/js/nbbrowser_main.js" type="text/javascript" charset="utf-8"></script>
57
48
58 </body>
49 </body>
59
50
General Comments 0
You need to be logged in to leave comments. Login now