[Factor password equality check into function
clinton@unknownlamer.org**20080209054155] {
hunk ./src/web.lisp 255
+(defun check-passwords-equal (password-change-tool)
+  (with-slots (new-password-1 new-password-2)
+	password-change-tool
+      (let ((password-1 (value new-password-1))
+	    (password-2 (value new-password-2)))
+	(if (and password-1 password-2)
+	    (string= password-1 password-2)
+	    t))))
+
+(defmethod validp ((field password-change-tool))
+  (multiple-value-bind (valid failed) (call-next-method)
+    (with-slots (user current-password new-password-1 new-password-2)
+	field
+      (cond ((not (check-passwords-equal field))
+	     ;; fixme: should at least be a validator class
+	     (push (cons new-password-1 "not equal") failed)
+	     (push (cons new-password-2 "not equal") failed)))
+      (if (and (value current-password)
+	       (not (golf-auth:check-password user (value current-password))))
+	  (push (cons current-password
+		      (make-instance 'password-incorrect-validator))
+		failed))
+      (values (null failed) failed))))
+
hunk ./src/web.lisp 281
-		 (golf-auth:username (slot-value self 'user)))))
+		 (golf-auth:username (slot-value self 'user))))
+  (if (not (check-passwords-equal self))
+      (<:h2 :class "error" (<:as-html "New Passwords Do Not Match"))))
}