Fix up login page to handle redirection correctly

This commit is contained in:
Tim Bentley 2013-03-26 11:39:32 +00:00
parent 4641a4d447
commit 451189b222
3 changed files with 6 additions and 8 deletions

View File

@ -35,8 +35,6 @@
<link rel="stylesheet" href="/files/jquery.mobile.css" />
<link rel="stylesheet" href="/files/login.css" />
<link rel="shortcut icon" type="image/x-icon" href="/files/images/favicon.ico">
<script type="text/javascript" src="/files/jquery.js"></script>
<script type="text/javascript" src="/files/jquery.mobile.js"></script>
</head>
<body>
<form method="post" action="/auth/login">

View File

@ -52,7 +52,6 @@ def check_credentials(user_name, password):
Verifies credentials for username and password.
Returns None on success or a string describing the error on failure
"""
print "check"
if user_name == Settings().value(u'remotes/user id') and password == Settings().value(u'remotes/password'):
return None
else:
@ -128,6 +127,7 @@ class AuthController(object):
login_html = os.path.normpath(os.path.join(directory, u'login.html'))
html = Template(filename=login_html, input_encoding=u'utf-8', output_encoding=u'utf-8').render(**variables)
cherrypy.response.headers['Content-Type'] = u'text/html'
cherrypy.response.status = 200
return html
@cherrypy.expose
@ -135,7 +135,6 @@ class AuthController(object):
"""
Provides the actual login control
"""
print "login", from_page
if username is None or password is None:
return self.get_login_form("", from_page=from_page)
error_msg = check_credentials(username, password)
@ -144,7 +143,6 @@ class AuthController(object):
else:
cherrypy.session[SESSION_KEY] = cherrypy.request.login = username
self.on_login(username)
print from_page
raise cherrypy.HTTPRedirect(from_page or "/")
@cherrypy.expose

View File

@ -227,7 +227,6 @@ class HttpConnection(object):
"""
Handles the requests for the main url. This is secure depending on settings in config.
"""
print "default"
self.request_data = None
if isinstance(kwargs, dict):
self.request_data = kwargs.get(u'data', None)
@ -252,7 +251,6 @@ class HttpConnection(object):
Common function to process HTTP requests where secure or insecure
"""
url = urlparse.urlparse(cherrypy.url())
#self.url_params = kwargs
response = None
for route, func in self.routes:
match = re.match(route, url.path)
@ -315,7 +313,11 @@ class HttpConnection(object):
'no_results': translate('RemotePlugin.Mobile', 'No Results'),
'options': translate('RemotePlugin.Mobile', 'Options'),
'service': translate('RemotePlugin.Mobile', 'Service'),
'slides': translate('RemotePlugin.Mobile', 'Slides')
'slides': translate('RemotePlugin.Mobile', 'Slides'),
'title': translate('RemotePlugin.Mobile', 'OpenLP 2.1 User Login'),
'from_page': "",
'message': "",
'username': "username"
}
def serve_file(self, filename=None):