diff options
Diffstat (limited to 'module')
| -rw-r--r-- | module/database/DatabaseBackend.py | 15 | ||||
| -rw-r--r-- | module/database/UserDatabase.py | 22 | ||||
| -rw-r--r-- | module/plugins/accounts/FileserveCom.py | 4 | ||||
| -rw-r--r-- | module/web/media/default/css/default.css | 19 | ||||
| -rw-r--r-- | module/web/media/default/img/user-info.png | bin | 0 -> 3963 bytes | |||
| -rw-r--r-- | module/web/pyload_app.py | 23 | ||||
| -rw-r--r-- | module/web/templates/default/base.html | 1 | ||||
| -rw-r--r-- | module/web/templates/default/info.html | 46 | 
8 files changed, 109 insertions, 21 deletions
| diff --git a/module/database/DatabaseBackend.py b/module/database/DatabaseBackend.py index 9e9e73e43..0ce01cdc5 100644 --- a/module/database/DatabaseBackend.py +++ b/module/database/DatabaseBackend.py @@ -233,22 +233,7 @@ class DatabaseBackend(Thread):              self.c.executemany("INSERT INTO users(name, password, email) VALUES (?, ?, ?)", users)              move("pyload.db", "pyload.old.db") -        if exists("web.db"): -            try: -                self.core.log.info(_("Moving users")) -            except: -                print "Moving users" -            conn = sqlite3.connect('web.db') -            c = conn.cursor() -            c.execute("SELECT name, password, email, role, permission FROM users") -            for r in c: -                self.c.execute('SELECT name FROM users WHERE name=?', (r[0], )) -                if self.c.fetchone() is None: -                    self.c.executemany("INSERT INTO users (name, password, email, role, permission) VALUES (?, ?, ?, ?, ?)", r) -            c.close() -            conn.close() -            move("web.db", "web.old.db")          self.c.execute('VACUUM')      def createCursor(self): diff --git a/module/database/UserDatabase.py b/module/database/UserDatabase.py index 6e04fa249..4367b1292 100644 --- a/module/database/UserDatabase.py +++ b/module/database/UserDatabase.py @@ -69,6 +69,28 @@ class UserMethods():              c.execute('INSERT INTO users (name, password) VALUES (?, ?)', (user, password)) +    @style.queue +    def changePw(db, user, oldpw, newpw): + +        db.c.execute('SELECT id, name, password, role, permission, template FROM "users" WHERE name=?', (user, )) +        r = db.c.fetchone() +        if not r: +            return False + +        salt = r[2][:5] +        pw = r[2][5:] +        h = sha1(salt + oldpw) +        if h.hexdigest() == pw: +            salt = reduce(lambda x, y: x + y, [str(random.randint(0, 9)) for i in range(0, 5)]) +            h = sha1(salt + newpw) +            password = salt + h.hexdigest() + +            db.c.execute("UPDATE users SET password=? WHERE name=?", (password, user)) +            return True + +        return False + +      @style.async      def setPermission(db, user, perms):          db.c.execute("UPDATE users SET permission=? WHERE name=?", (perms, user)) diff --git a/module/plugins/accounts/FileserveCom.py b/module/plugins/accounts/FileserveCom.py index 752987c0d..44b3f5be5 100644 --- a/module/plugins/accounts/FileserveCom.py +++ b/module/plugins/accounts/FileserveCom.py @@ -23,7 +23,7 @@ from time import strptime, mktime  class FileserveCom(Account):      __name__ = "FileserveCom" -    __version__ = "0.1" +    __version__ = "0.11"      __type__ = "account"      __description__ = """fileserve.com account plugin"""      __author_name__ = ("mkaay") @@ -50,7 +50,7 @@ class FileserveCom(Account):                  post={"loginUserName": user, "loginUserPassword": data["password"],                        "autoLogin": "on", "loginFormSubmit": "Login"}, cookies=True) -        if r'Please Enter a valid user name.' in html: +        if r'Please Enter a valid user name.' in html or "Username doesn't exist." in html:              self.wrongPassword()          req.load("http://fileserve.com/dashboard.php", cookies=True) diff --git a/module/web/media/default/css/default.css b/module/web/media/default/css/default.css index e3f3a4e46..978aeadde 100644 --- a/module/web/media/default/css/default.css +++ b/module/web/media/default/css/default.css @@ -248,6 +248,11 @@ a.action.recent {  a.logout {
  	background:transparent url(/media/default/img/user-actions-logout.png) 0px 1px no-repeat;
  }
 +
 +a.info {
 +    background:transparent url(/media/default/img/user-info.png) 0px 1px no-repeat;
 +}
 +
  a.admin {
  	background:transparent url(/media/default/img/user-actions-admin.png) 0px 1px no-repeat;
  }
 @@ -887,3 +892,17 @@ ul.nav ul ul {  	background:url(/media/default/img//notice.png) no-repeat #000 7px 10px;
  	width:280px;
  }
 +
 +table.system {
 +    border: none;
 +    margin-left: 10px;
 +}
 +
 +table.system td {
 +    border: none
 +}
 +
 +table.system tr > td:first-child {
 +    font-weight: bold;
 +    padding-right: 10px;
 +}
\ No newline at end of file diff --git a/module/web/media/default/img/user-info.png b/module/web/media/default/img/user-info.pngBinary files differ new file mode 100644 index 000000000..6e643100f --- /dev/null +++ b/module/web/media/default/img/user-info.png diff --git a/module/web/pyload_app.py b/module/web/pyload_app.py index 179cf4cfc..a71232f2b 100644 --- a/module/web/pyload_app.py +++ b/module/web/pyload_app.py @@ -24,16 +24,14 @@ import os  import time  from os import listdir -from os.path import isdir -from os.path import isfile -from os.path import join +from os.path import isdir, isfile, join ,abspath  from sys import getfilesystemencoding  from hashlib import sha1  from urllib import unquote  from bottle import route, static_file, request, response, redirect, HTTPError, error -from webinterface import PYLOAD, PROJECT_DIR, SETUP +from webinterface import PYLOAD, PYLOAD_DIR, PROJECT_DIR, SETUP  from utils import render_to_response, parse_permissions, parse_userdata, login_required, get_permission, set_permission  from filters import relpath, unquotepath @@ -510,3 +508,20 @@ def setup():          return base([_("Run pyLoadCore.py -s to access the setup.")])      return render_to_response('setup.html', {"user" : False, "perms": False}) + +@route("/info") +def info(): + +    conf = PYLOAD.get_config() + +    data = {} +    data["version"] = PYLOAD.get_server_version() +    data["folder"] = abspath(PYLOAD_DIR) +    data["config"] = abspath("") +    data["download"] = abspath(conf["general"]["download_folder"]["value"]) +    data["remote"] = conf["remote"]["port"]["value"] +    data["webif"] = conf["webinterface"]["port"]["value"] +    data["language"] = conf["general"]["language"]["value"] + + +    return render_to_response("info.html", data, [pre_processor])
\ No newline at end of file diff --git a/module/web/templates/default/base.html b/module/web/templates/default/base.html index 323f38b66..7f7db2610 100644 --- a/module/web/templates/default/base.html +++ b/module/web/templates/default/base.html @@ -231,6 +231,7 @@ function AddBox()  		{% if user.is_admin %}
  		<li><a href="/admin" class="action profile" rel="nofollow">{{_("Administrate")}}</a></li>
  		{% endif %}
 +        <li><a href="/info"  class="action info" rel="nofollow">{{_("Info")}}</a></li>
  	</ul>
  {% else %}
 diff --git a/module/web/templates/default/info.html b/module/web/templates/default/info.html new file mode 100644 index 000000000..d1acb804c --- /dev/null +++ b/module/web/templates/default/info.html @@ -0,0 +1,46 @@ +{% extends 'default/base.html' %} + +{% block title %}{{ _("Information") }} - {{ super() }} {% endblock %} +{% block subtitle %}{{ _("Information") }}{% endblock %} + + +{% block content %} +    <h3>{{ _("News") }}</h3> +    <div id="twitter"> +        <ul id="twitter_update_list"></ul> +        <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script> +        <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/pyLoad.json?callback=twitterCallback2&count=6"></script> +    </div> +    <h3>{{ _("System") }}</h3> +    <table class="system"> +    <tr> +        <td>Version:</td> +        <td>{{ version }}</td> +    </tr> +    <tr> +        <td>Installation Folder:</td> +        <td>{{ folder }}</td> +    </tr> +    <tr> +        <td>Config Folder:</td> +        <td>{{ config }}</td> +    </tr> +    <tr> +        <td>Download Folder:</td> +        <td>{{ download }}</td> +    </tr> +    <tr> +        <td>Language:</td> +        <td>{{ language }}</td> +    </tr> +    <tr> +        <td>Webinterface Port:</td> +        <td>{{ webif }}</td> +    </tr> +    <tr> +        <td>Remote Interface Port:</td> +        <td>{{ remote }}</td> +    </tr> +    </table> + +{% endblock %}
\ No newline at end of file | 
