public function validateExtended()
 {
     $this->validateEmail();
     if ($this->getElementValue('password1') != '') {
         if (strlen($this->getElementValue('password1')) < 6) {
             $this->getElement('password1')->setValidationError('User a longer password, at least 6 chars.');
         }
         if ($this->getElementValue('password1') != $this->getElementValue('password2')) {
             $this->getElement('password2')->setValidationError('Those passwords do not match.');
         }
         if ($this->user->getUsername() == Session::getUser()->getUsername()) {
             $passwordCurrent = $this->getElementValue('passwordCurrent');
             if (empty($passwordCurrent)) {
                 $this->getElement('passwordCurrent')->setValidationError('If changing your password, you must enter your current password first.');
             }
             try {
                 AuthBackend::getBackend()->checkCredentials($this->user->getUsername(), $passwordCurrent);
             } catch (Exception $e) {
                 $this->getElement('passwordCurrent')->setValidationError('This does not appear to be your current password.');
             }
         }
     }
 }