]> git.andy128k.dev Git - ipf.git/commitdiff
Change SelfPassword Form
authoravl <alex.litovchenko@gmail.com>
Tue, 9 Sep 2008 11:48:26 +0000 (14:48 +0300)
committeravl <alex.litovchenko@gmail.com>
Tue, 9 Sep 2008 11:48:26 +0000 (14:48 +0300)
ipf/auth/forms/changeselfpassword.php [new file with mode: 0644]

diff --git a/ipf/auth/forms/changeselfpassword.php b/ipf/auth/forms/changeselfpassword.php
new file mode 100644 (file)
index 0000000..2a8e7f4
--- /dev/null
@@ -0,0 +1,23 @@
+<?php 
+
+class IPF_Auth_Forms_ChangeSelfPassword extends IPF_Form{
+    
+    function initFields($extra=array())
+    {
+        $this->fields['oldpassword'] = new IPF_Form_Field_Varchar(array(label=>'Current Password', 'required'=>true, 'widget'=>'IPF_Form_Widget_PasswordInput'));
+        $this->fields['password1'] = new IPF_Form_Field_Varchar(array(label=>'New Password', 'required'=>true,'widget'=>'IPF_Form_Widget_PasswordInput'));
+        $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(){
+        $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;
+            }
+        }
+        return $ok;
+    }
+}