diff options
| author | 2013-07-24 17:42:43 +0200 | |
|---|---|---|
| committer | 2013-07-24 17:42:56 +0200 | |
| commit | f0bfb8a13b6b488c561084a4a33acc9b75984b03 (patch) | |
| tree | 22ef409a315a5afdb2bb93157dd751f2d61d8a71 /pyload/web/api_app.py | |
| parent | DebridItaliaCom: two more hosters supported (diff) | |
| download | pyload-f0bfb8a13b6b488c561084a4a33acc9b75984b03.tar.xz | |
improved login mechanism
Diffstat (limited to 'pyload/web/api_app.py')
| -rw-r--r-- | pyload/web/api_app.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pyload/web/api_app.py b/pyload/web/api_app.py index 3ffc507aa..c88be0519 100644 --- a/pyload/web/api_app.py +++ b/pyload/web/api_app.py @@ -8,12 +8,13 @@ from traceback import format_exc, print_exc from bottle import route, request, response, HTTPError, parse_auth from utils import set_session, get_user_api -from webinterface import PYLOAD +from webinterface import PYLOAD, session from pyload.Api import ExceptionObject -from pyload.remote.json_converter import loads, dumps +from pyload.remote.json_converter import loads, dumps, BaseEncoder from pyload.utils import remove_chars + def add_header(r): r.headers.replace("Content-type", "application/json") r.headers.append("Cache-Control", "no-cache, must-revalidate") @@ -95,10 +96,13 @@ def login(): # get the session id by dirty way, documentations seems wrong try: sid = s._headers["cookie_out"].split("=")[1].split(";")[0] - return dumps(sid) + # reuse old session id except: - print "Could not get session" - return dumps(True) + sid = request.get_header(session.options['key']) + + result = BaseEncoder().default(user) + result["session"] = sid + return dumps(result) @route("/api/logout") |
