Make login_available method LoginHandler.get_login_available

There was a conflict for the .login_available property on LoginHandler itself
causing the login form to render incorrectly when login_available should be False
This commit is contained in:
Min RK 2016-10-12 15:07:22 +02:00
parent cd60550413
commit 6c5cca1328
2 changed files with 3 additions and 3 deletions

View File

@ -69,7 +69,7 @@ class LoginHandler(IPythonHandler):
typed_password = self.get_argument('password', default=u'')
cookie_options = self.settings.get('cookie_options', {})
cookie_options.setdefault('httponly', True)
if self.login_available(self.settings):
if self.get_login_available(self.settings):
if passwd_check(self.hashed_password, typed_password):
# tornado <4.2 has a bug that considers secure==True as soon as
# 'secure' kwarg is passed to set_secure_cookie
@ -129,6 +129,6 @@ class LoginHandler(IPythonHandler):
return settings.get('password', u'')
@classmethod
def login_available(cls, settings):
def get_login_available(cls, settings):
"""Whether this LoginHandler is needed - and therefore whether the login page should be displayed."""
return bool(cls.password_from_settings(settings))

View File

@ -109,7 +109,7 @@ class AuthenticatedHandler(web.RequestHandler):
"""
if self.login_handler is None:
return False
return bool(self.login_handler.login_available(self.settings))
return bool(self.login_handler.get_login_available(self.settings))
class IPythonHandler(AuthenticatedHandler):