From 8cb2c3931c48d663096b840a6d8d656cc2c733bd Mon Sep 17 00:00:00 2001 From: avl Date: Tue, 9 Sep 2008 15:03:52 +0300 Subject: [PATCH] fixes for ChangeSelfPassword Form --- ipf/auth/forms/changepassword.php | 2 +- ipf/auth/forms/changeselfpassword.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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; -- 2.49.0