From: avl Date: Tue, 9 Sep 2008 12:03:52 +0000 (+0300) Subject: fixes for ChangeSelfPassword Form X-Git-Tag: 0.5~499 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=8cb2c3931c48d663096b840a6d8d656cc2c733bd;p=ipf.git fixes for ChangeSelfPassword Form --- diff --git a/ipf/auth/forms/changepassword.php b/ipf/auth/forms/changepassword.php index f63af96..2950bf7 100644 --- a/ipf/auth/forms/changepassword.php +++ b/ipf/auth/forms/changepassword.php @@ -14,7 +14,7 @@ class IPF_Auth_Forms_ChangePassword extends IPF_Form{ if ($this->cleaned_data['password1']!=$this->cleaned_data['password2']){ $this->is_valid = false; $this->errors['password2'][] = "The two password fields didn't match."; - return false; + $ok = false; } } return $ok; diff --git a/ipf/auth/forms/changeselfpassword.php b/ipf/auth/forms/changeselfpassword.php index 2a8e7f4..cb4eb3b 100644 --- a/ipf/auth/forms/changeselfpassword.php +++ b/ipf/auth/forms/changeselfpassword.php @@ -9,13 +9,19 @@ class IPF_Auth_Forms_ChangeSelfPassword extends IPF_Form{ $this->fields['password2'] = new IPF_Form_Field_Varchar(array(label=>'New Password (repeat)','required'=>true,'widget'=>'IPF_Form_Widget_PasswordInput','help_text'=>'Enter the same password as above, for verification.')); } - function isValid(){ + function isValid($request){ $ok = parent::isValid(); if ($ok===true){ if ($this->cleaned_data['password1']!=$this->cleaned_data['password2']){ $this->is_valid = false; $this->errors['password2'][] = "The two password fields didn't match."; - return false; + $ok = false; + } + $u = new User(); + if ($u->checkCreditentials($request->user->username, $this->cleaned_data['oldpassword'])===false){ + $this->is_valid = false; + $this->errors['oldpassword'][] = "Incorrect old password"; + $ok = false; } } return $ok;