webui:fix pwd update(+better css)

This commit is contained in:
Martijn Voncken 2008-03-26 19:37:14 +00:00
parent 1f3932e13f
commit 24b7cff766
4 changed files with 26 additions and 10 deletions

View File

@ -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(

View File

@ -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:

View File

@ -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;
}

View File

@ -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()