From 3254a85595dd27a96862d8d7b932c03ade166f95 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 27 May 2011 22:52:24 +0200 Subject: change password in webif --- module/database/UserDatabase.py | 6 +- module/network/HTTPDownload.py | 8 ++ module/plugins/hoster/FilesonicCom.py | 11 +- module/plugins/hoster/RealdebridCom.py | 20 ++- module/web/json_app.py | 10 ++ module/web/templates/default/admin.html | 224 ++++++++++++++++++++++------- module/web/templates/default/settings.html | 2 +- 7 files changed, 210 insertions(+), 71 deletions(-) (limited to 'module') diff --git a/module/database/UserDatabase.py b/module/database/UserDatabase.py index 11bdbabc0..0e3011593 100644 --- a/module/database/UserDatabase.py +++ b/module/database/UserDatabase.py @@ -71,9 +71,9 @@ class UserMethods(): @style.queue - def changePw(db, user, oldpw, newpw): + def changePassword(db, user, oldpw, newpw): - db.c.execute('SELECT id, name, password, role, permission, template FROM "users" WHERE name=?', (user, )) + db.c.execute('SELECT id, name, password FROM users WHERE name=?', (user, )) r = db.c.fetchone() if not r: return False @@ -118,10 +118,8 @@ class UserMethods(): return user - @style.queue def removeUser(db, user): db.c.execute('DELETE FROM users WHERE name=?', (user, )) - DatabaseBackend.registerSub(UserMethods) diff --git a/module/network/HTTPDownload.py b/module/network/HTTPDownload.py index 40e2e69e1..603fea7a8 100644 --- a/module/network/HTTPDownload.py +++ b/module/network/HTTPDownload.py @@ -124,6 +124,14 @@ class HTTPDownload(): try: self._download(chunks, resume) + except pycurl.error, e: + #code 33 - no resume + code = e.args[0] + if code == 33: + # try again without resume + return self._download(chunks, False) + else: + raise e finally: self.close() diff --git a/module/plugins/hoster/FilesonicCom.py b/module/plugins/hoster/FilesonicCom.py index 8862c84e0..6aabcc277 100644 --- a/module/plugins/hoster/FilesonicCom.py +++ b/module/plugins/hoster/FilesonicCom.py @@ -62,8 +62,8 @@ class FilesonicCom(Hoster): CAPTCHA_TYPE1_PATTERN = r'Recaptcha.create\("(.*?)",' CAPTCHA_TYPE2_PATTERN = r'id="recaptcha_image"> + + var password_dialog; + + function show_password_dialog() { + bg_show(); + $("password_box").setStyle('display', 'block'); + password_dialog.start('opacity', 1) + } + + function hide_password_dialog() { + bg_hide(); + password_dialog.start('opacity', 0).chain(function() { + $('password_box').setStyle('display', 'none'); + }); + } + + window.addEvent("domready", function() { + + password_dialog = new Fx.Tween($("password_box")); + + $("login_password_reset").addEvent("click", hide_password_dialog); + $("login_password_button").addEvent("click", function(e) { + + var current = $("login_current_password").get("value"); + var newpw = $("login_new_password").get("value"); + var newpw2 = $("login_new_password2").get("value"); + + if (newpw == newpw2) { + var form = $("password_form"); + + form.set("send", { + onSuccess: function(data) { + notify.alert("Success", { + 'className': 'success' + }); + }, + onFailure: function(data) { + notify.alert("Error", { + 'className': 'error' + }); + }}); + + form.send(); + + hide_password_dialog(); + } else { + alert("{{_("Passwords did not match.")}}"); + } + e.stop(); + }); + + $$(".change_password").each(function(item) { + var id = item.get("id"); + var user = id.split("|")[1]; + $("user_login").set("value", user); + + item.addEvent("click", function(e) { + show_password_dialog(); + }); + }); + }); + +{% endblock %} + + {% block title %}{{ _("Administrate User") }} - {{ super() }} {% endblock %} {% block subtitle %}{{ _("Administrate User") }}{% endblock %} {% block content %} -{{ _("Note: You can only change permissions for webinterface.") }} -{{ _("To add user or change passwords use:") }} python pyLoadCore.py -u
-{{ _("Important: Admin user have always all permissions! Only Admin user can use other clients like CLI and GUI.") }} - -
- - - - - - - - - - - - - -{% for name, data in users.iteritems() %} - - - - - - - - - - - -{% endfor %} - - -
- {{ _("Name") }} - - {{ _("Admin") }} - - {{ _("Add downloads") }} - - {{ _("Delete downloads") }} - - {{ _("Change server status") }} - - {{ _("See queue/collector") }} - - {{ _("Download from webinterface") }} - - {{ _("Change settings") }} - - {{ _("Filemanager") }} -
{{name}}
- - -
+ {{ _("Note: You can only change permissions for webinterface.") }} + {{ _("To add user or change passwords use:") }} python pyLoadCore.py -u
+ {{ _("Important: Admin user have always all permissions! Only Admin user can use other clients like CLI and GUI.") }} + +
+ + + + + + + + + + + + + + + {% for name, data in users.iteritems ( ) %} + + + + + + + + + + + + + {% endfor %} + + +
+ {{ _("Name") }} + + {{ _("Change Password") }} + + {{ _("Admin") }} + + {{ _("Add downloads") }} + + {{ _("Delete downloads") }} + + {{ _("Change server status") }} + + {{ _("See queue/collector") }} + + {{ _("Download from webinterface") }} + + {{ _("Change settings") }} + + {{ _("Filemanager") }} +
{{ name }}{{ _("change") }}
+ + +
+ + +
+
+

{{ _("Change Password") }}

+ +

{{ _("Enter your current and desired Password.") }}

+ + + + + + + + + + + + + + + +
+ +
+ +
{% endblock %} \ No newline at end of file diff --git a/module/web/templates/default/settings.html b/module/web/templates/default/settings.html index 4c8f0d63e..a74fe4261 100644 --- a/module/web/templates/default/settings.html +++ b/module/web/templates/default/settings.html @@ -215,7 +215,7 @@ -- cgit v1.2.3