From 24b7cff766aa584307544d098394fb4b086c8eef Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Wed, 26 Mar 2008 19:37:14 +0000 Subject: [PATCH] webui:fix pwd update(+better css) --- deluge/ui/webui/config_tabs_webui.py | 5 ++-- deluge/ui/webui/lib/newforms_portable/util.py | 1 + .../webui/templates/white/template_style.css | 23 +++++++++++++++---- deluge/ui/webui/utils.py | 7 +++--- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/deluge/ui/webui/config_tabs_webui.py b/deluge/ui/webui/config_tabs_webui.py index db358856f..5f63cfe45 100644 --- a/deluge/ui/webui/config_tabs_webui.py +++ b/deluge/ui/webui/config_tabs_webui.py @@ -81,11 +81,10 @@ class Password(forms.Form): new2 = forms.Password(_("New Password (Confirm)")) def save(self,data): - ws.update_pwd(data.new1) - ws.save_config() + utils.update_pwd(data.new1) def validate(self, data): - if not ws.check_pwd(data.old_pwd): + if not utils.check_pwd(data.old_pwd): raise forms.ValidationError(_("Old password is invalid")) if data.new1 <> data.new2: raise forms.ValidationError( diff --git a/deluge/ui/webui/lib/newforms_portable/util.py b/deluge/ui/webui/lib/newforms_portable/util.py index b3edf41ad..a353bf0ac 100644 --- a/deluge/ui/webui/lib/newforms_portable/util.py +++ b/deluge/ui/webui/lib/newforms_portable/util.py @@ -55,6 +55,7 @@ class ValidationError(Exception): ValidationError can be passed any object that can be printed (usually a string) or a list of objects. """ + self.message = message #newforms_portable! if isinstance(message, list): self.messages = ErrorList([smart_unicode(msg) for msg in message]) else: diff --git a/deluge/ui/webui/templates/white/template_style.css b/deluge/ui/webui/templates/white/template_style.css index 018a68465..0f1589feb 100644 --- a/deluge/ui/webui/templates/white/template_style.css +++ b/deluge/ui/webui/templates/white/template_style.css @@ -242,8 +242,23 @@ div.progress_bar{ text-align:right; } - - - - /*config:*/ + +/*newforms*/ +ul.errorlist { + display:inline; + float:right; + height:15px; + padding:5px; + margin:0px; + padding-left:10px; +} + +ul.errorlist > li { + background-color:#FFFFFF; + color:#AA0000; + display:inline; + padding:0px; + margin:0px; + +} \ No newline at end of file diff --git a/deluge/ui/webui/utils.py b/deluge/ui/webui/utils.py index bfd3f8fce..33fb0175d 100644 --- a/deluge/ui/webui/utils.py +++ b/deluge/ui/webui/utils.py @@ -256,12 +256,13 @@ def update_pwd(pwd): sm = md5() sm.update(str(random.getrandbits(5000))) salt = sm.digest() - config["pwd_salt"] = salt - # m = md5() m.update(salt) m.update(pwd) - config["pwd_md5"] = m.digest() + # + config.set("pwd_salt", salt) + config.set("pwd_md5", m.digest()) + config.save() def check_pwd(pwd): m = md5()