]> git.andy128k.dev Git - ipf.git/commitdiff
fixes for ChangeSelfPassword Form
authoravl <alex.litovchenko@gmail.com>
Tue, 9 Sep 2008 12:03:52 +0000 (15:03 +0300)
committeravl <alex.litovchenko@gmail.com>
Tue, 9 Sep 2008 12:03:52 +0000 (15:03 +0300)
ipf/auth/forms/changepassword.php
ipf/auth/forms/changeselfpassword.php

index f63af96b7e1ccf33433e60c8f1e364aaf39aba1a..2950bf71592ba9b487cca4a20e8a73ef4f9ddd00 100644 (file)
@@ -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;
index 2a8e7f458ca0fe7ab850b48e21bd36601b78aa6a..cb4eb3b5854b7cf1eef691b462ce50fa2be5c9c6 100644 (file)
@@ -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;