diff options
author | mkaay <mkaay@mkaay.de> | 2011-02-05 14:19:22 +0100 |
---|---|---|
committer | mkaay <mkaay@mkaay.de> | 2011-02-05 14:19:22 +0100 |
commit | 7c332ae610f7feca193ba50ea900f5a417681a7b (patch) | |
tree | e71f1ba6b8eb52f13c11289069d65288b17a111c /module/web/ServerThread.py | |
parent | py 2.5 fix -> removed import (diff) | |
download | pyload-7c332ae610f7feca193ba50ea900f5a417681a7b.tar.xz |
created unified authentication system (same data for webinterface an GUI/CLI, multiple accounts)
Diffstat (limited to 'module/web/ServerThread.py')
-rw-r--r-- | module/web/ServerThread.py | 48 |
1 files changed, 1 insertions, 47 deletions
diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py index 9a3e6cb2a..297eb2f8f 100644 --- a/module/web/ServerThread.py +++ b/module/web/ServerThread.py @@ -3,7 +3,6 @@ from __future__ import with_statement from os.path import exists import threading import logging -import sqlite3 core = None log = logging.getLogger("log") @@ -28,8 +27,6 @@ class WebServer(threading.Thread): import webinterface global webinterface - self.checkDB() - if self.https: if not exists(self.cert) or not exists(self.key): log.warning(_("SSL certificates not found.")) @@ -57,49 +54,6 @@ class WebServer(threading.Thread): else: self.start_builtin() - - def checkDB(self): - conn = sqlite3.connect('web.db') - c = conn.cursor() - c.execute("SELECT * from users LIMIT 1") - empty = True - if c.fetchone(): - empty = False - - c.close() - conn.close() - - if not empty: - return True - - if exists("pyload.db"): - log.info(_("Converting old database to new web.db")) - conn = sqlite3.connect('pyload.db') - c = conn.cursor() - c.execute("SELECT username, password, email from auth_user WHERE is_superuser") - users = [] - for r in c: - pw = r[1].split("$") - users.append((r[0], pw[1] + pw[2], r[2])) - - c.close() - conn.close() - - conn = sqlite3.connect('web.db') - c = conn.cursor() - c.executemany("INSERT INTO users(name, password, email) VALUES (?,?,?)", users) - conn.commit() - c.close() - conn.close() - return True - - else: - log.warning(_("Database for Webinterface does not exitst, it will not be available.")) - log.warning(_("Please run: python pyLoadCore.py -s")) - log.warning(_("Go through the setup and create a database and add an user to gain access.")) - return False - - def start_builtin(self): if self.https: @@ -124,4 +78,4 @@ class WebServer(threading.Thread): webinterface.run_fcgi(host=self.host, port=self.port) def quit(self): - self.running = False
\ No newline at end of file + self.running = False |