mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
webui:fix pwd update(+better css)
This commit is contained in:
parent
1f3932e13f
commit
24b7cff766
4 changed files with 26 additions and 10 deletions
|
@ -81,11 +81,10 @@ class Password(forms.Form):
|
||||||
new2 = forms.Password(_("New Password (Confirm)"))
|
new2 = forms.Password(_("New Password (Confirm)"))
|
||||||
|
|
||||||
def save(self,data):
|
def save(self,data):
|
||||||
ws.update_pwd(data.new1)
|
utils.update_pwd(data.new1)
|
||||||
ws.save_config()
|
|
||||||
|
|
||||||
def validate(self, data):
|
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"))
|
raise forms.ValidationError(_("Old password is invalid"))
|
||||||
if data.new1 <> data.new2:
|
if data.new1 <> data.new2:
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
|
|
|
@ -55,6 +55,7 @@ class ValidationError(Exception):
|
||||||
ValidationError can be passed any object that can be printed (usually
|
ValidationError can be passed any object that can be printed (usually
|
||||||
a string) or a list of objects.
|
a string) or a list of objects.
|
||||||
"""
|
"""
|
||||||
|
self.message = message #newforms_portable!
|
||||||
if isinstance(message, list):
|
if isinstance(message, list):
|
||||||
self.messages = ErrorList([smart_unicode(msg) for msg in message])
|
self.messages = ErrorList([smart_unicode(msg) for msg in message])
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -242,8 +242,23 @@ div.progress_bar{
|
||||||
text-align:right;
|
text-align:right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*config:*/
|
/*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;
|
||||||
|
|
||||||
|
}
|
|
@ -256,12 +256,13 @@ def update_pwd(pwd):
|
||||||
sm = md5()
|
sm = md5()
|
||||||
sm.update(str(random.getrandbits(5000)))
|
sm.update(str(random.getrandbits(5000)))
|
||||||
salt = sm.digest()
|
salt = sm.digest()
|
||||||
config["pwd_salt"] = salt
|
|
||||||
#
|
|
||||||
m = md5()
|
m = md5()
|
||||||
m.update(salt)
|
m.update(salt)
|
||||||
m.update(pwd)
|
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):
|
def check_pwd(pwd):
|
||||||
m = md5()
|
m = md5()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue