From ae37e2fe2ce2f3fb2b71c1ebb8d7394a5fbe5cfb Mon Sep 17 00:00:00 2001 From: "Brian E. Granger" Date: Tue, 6 Sep 2011 22:12:50 -0700 Subject: [PATCH] Simplifying logic on login page. --- IPython/frontend/html/notebook/handlers.py | 8 ++--- .../html/notebook/static/js/login_main.js | 29 +++++++++++++++++++ .../html/notebook/templates/login.html | 17 +++-------- 3 files changed, 37 insertions(+), 17 deletions(-) create mode 100644 IPython/frontend/html/notebook/static/js/login_main.js diff --git a/IPython/frontend/html/notebook/handlers.py b/IPython/frontend/html/notebook/handlers.py index bf5a2ecf4..544959957 100644 --- a/IPython/frontend/html/notebook/handlers.py +++ b/IPython/frontend/html/notebook/handlers.py @@ -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) diff --git a/IPython/frontend/html/notebook/static/js/login_main.js b/IPython/frontend/html/notebook/static/js/login_main.js new file mode 100644 index 000000000..420f935af --- /dev/null +++ b/IPython/frontend/html/notebook/static/js/login_main.js @@ -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'); + +}); + diff --git a/IPython/frontend/html/notebook/templates/login.html b/IPython/frontend/html/notebook/templates/login.html index 817b83352..d00e512e0 100644 --- a/IPython/frontend/html/notebook/templates/login.html +++ b/IPython/frontend/html/notebook/templates/login.html @@ -10,18 +10,10 @@ - + - +
-
+ Password:
@@ -52,8 +44,7 @@ - - +