forked from openlp/openlp
Fix up login page to handle redirection correctly
This commit is contained in:
parent
4641a4d447
commit
451189b222
@ -35,8 +35,6 @@
|
|||||||
<link rel="stylesheet" href="/files/jquery.mobile.css" />
|
<link rel="stylesheet" href="/files/jquery.mobile.css" />
|
||||||
<link rel="stylesheet" href="/files/login.css" />
|
<link rel="stylesheet" href="/files/login.css" />
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/files/images/favicon.ico">
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form method="post" action="/auth/login">
|
<form method="post" action="/auth/login">
|
||||||
|
@ -52,7 +52,6 @@ def check_credentials(user_name, password):
|
|||||||
Verifies credentials for username and password.
|
Verifies credentials for username and password.
|
||||||
Returns None on success or a string describing the error on failure
|
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'):
|
if user_name == Settings().value(u'remotes/user id') and password == Settings().value(u'remotes/password'):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
@ -128,6 +127,7 @@ class AuthController(object):
|
|||||||
login_html = os.path.normpath(os.path.join(directory, u'login.html'))
|
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)
|
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.headers['Content-Type'] = u'text/html'
|
||||||
|
cherrypy.response.status = 200
|
||||||
return html
|
return html
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@ -135,7 +135,6 @@ class AuthController(object):
|
|||||||
"""
|
"""
|
||||||
Provides the actual login control
|
Provides the actual login control
|
||||||
"""
|
"""
|
||||||
print "login", from_page
|
|
||||||
if username is None or password is None:
|
if username is None or password is None:
|
||||||
return self.get_login_form("", from_page=from_page)
|
return self.get_login_form("", from_page=from_page)
|
||||||
error_msg = check_credentials(username, password)
|
error_msg = check_credentials(username, password)
|
||||||
@ -144,7 +143,6 @@ class AuthController(object):
|
|||||||
else:
|
else:
|
||||||
cherrypy.session[SESSION_KEY] = cherrypy.request.login = username
|
cherrypy.session[SESSION_KEY] = cherrypy.request.login = username
|
||||||
self.on_login(username)
|
self.on_login(username)
|
||||||
print from_page
|
|
||||||
raise cherrypy.HTTPRedirect(from_page or "/")
|
raise cherrypy.HTTPRedirect(from_page or "/")
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
@ -227,7 +227,6 @@ class HttpConnection(object):
|
|||||||
"""
|
"""
|
||||||
Handles the requests for the main url. This is secure depending on settings in config.
|
Handles the requests for the main url. This is secure depending on settings in config.
|
||||||
"""
|
"""
|
||||||
print "default"
|
|
||||||
self.request_data = None
|
self.request_data = None
|
||||||
if isinstance(kwargs, dict):
|
if isinstance(kwargs, dict):
|
||||||
self.request_data = kwargs.get(u'data', None)
|
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
|
Common function to process HTTP requests where secure or insecure
|
||||||
"""
|
"""
|
||||||
url = urlparse.urlparse(cherrypy.url())
|
url = urlparse.urlparse(cherrypy.url())
|
||||||
#self.url_params = kwargs
|
|
||||||
response = None
|
response = None
|
||||||
for route, func in self.routes:
|
for route, func in self.routes:
|
||||||
match = re.match(route, url.path)
|
match = re.match(route, url.path)
|
||||||
@ -315,7 +313,11 @@ class HttpConnection(object):
|
|||||||
'no_results': translate('RemotePlugin.Mobile', 'No Results'),
|
'no_results': translate('RemotePlugin.Mobile', 'No Results'),
|
||||||
'options': translate('RemotePlugin.Mobile', 'Options'),
|
'options': translate('RemotePlugin.Mobile', 'Options'),
|
||||||
'service': translate('RemotePlugin.Mobile', 'Service'),
|
'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):
|
def serve_file(self, filename=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user