Simplifying logic on login page.

pull/37/head
Brian E. Granger 15 years ago committed by MinRK
parent 1f699c8c23
commit ae37e2fe2c

@ -70,13 +70,13 @@ class NBBrowserHandler(AuthenticatedHandler):
class LoginHandler(AuthenticatedHandler):
def get(self):
self.render('login.html')
self.render('login.html', next='/')
def post(self):
pwd = self.get_argument("password", default=u'')
pwd = self.get_argument('password', default=u'')
if self.application.password and pwd == self.application.password:
self.set_secure_cookie("user", str(uuid.uuid4()))
url = self.get_argument("next", default="/")
self.set_secure_cookie('user', str(uuid.uuid4()))
url = self.get_argument('next', default='/')
self.redirect(url)

@ -0,0 +1,29 @@
//----------------------------------------------------------------------------
// Copyright (C) 2008-2011 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//----------------------------------------------------------------------------
//============================================================================
// On document ready
//============================================================================
$(document).ready(function () {
$('div#header').addClass('border-box-sizing');
$('div#header_border').addClass('border-box-sizing ui-widget ui-widget-content');
$('div#main_app').addClass('border-box-sizing ui-widget');
$('div#app_hbox').addClass('hbox');
$('div#left_panel').addClass('box-flex');
$('div#right_panel').addClass('box-flex');
// These have display: none in the css file and are made visible here to prevent FLOUC.
$('div#header').css('display','block');
$('div#main_app').css('display','block');
});

@ -10,18 +10,10 @@
<link rel="stylesheet" href="static/css/boilerplate.css" type="text/css" />
<link rel="stylesheet" href="static/css/layout.css" type="text/css" />
<link rel="stylesheet" href="static/css/base.css" type="text/css" />
<script type="text/javascript" charset="utf-8">
function add_next_to_action(){
// add 'next' argument to action url, to preserve redirect
var query = location.search.substring(1);
var form = document.forms[0];
var action = form.getAttribute("action");
form.setAttribute("action", action + '?' + query);
}
</script>
</head>
<body onload="add_next_to_action()">
<body>
<div id="header">
<span id="ipython_notebook"><h1>IPython Notebook</h1></span>
@ -37,7 +29,7 @@
</div>
<div id="content_panel">
<form action="/login" method="post">
<form action="/login?next={{url_escape(next)}}" method="post">
Password: <input type="password" name="password">
<input type="submit" value="Sign in">
</form>
@ -52,8 +44,7 @@
<script src="static/jquery/js/jquery-1.6.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="static/jquery/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript" charset="utf-8"></script>
<script src="static/js/namespace.js" type="text/javascript" charset="utf-8"></script>
<script src="static/js/notebooklist.js" type="text/javascript" charset="utf-8"></script>
<script src="static/js/nbbrowser_main.js" type="text/javascript" charset="utf-8"></script>
<script src="static/js/login_main.js" type="text/javascript" charset="utf-8"></script>
</body>

Loading…
Cancel
Save