/**
  * The place to check if the data set in the snippet is valid
  * to generate the snippet.
  *
  * When invalid data should result in an error, you can throw it
  * here but you can also perform the check in the
  * checkRegistryRequestsAnswers() function from the
  * {@see \MUtil_Registry_TargetInterface}.
  *
  * @return boolean
  */
 public function hasHtmlOutput()
 {
     if (!($this->user->hasAllowedRole() && $this->user->canSetPassword())) {
         $this->addMessage($this->getNotAllowedMessage());
         return false;
     }
     return parent::hasHtmlOutput();
 }
 /**
  * Return true if a password reset key can be created.
  *
  * Returns the setting for the definition whan no user is passed, otherwise
  * returns the answer for this specific user.
  *
  * @param \Gems_User_User $user Optional, the user whose password might change
  * @return boolean
  */
 public function canResetPassword(\Gems_User_User $user = null)
 {
     if ($user) {
         // Depends on the user.
         if ($user->hasEmailAddress() && $user->canSetPassword()) {
             $email = $user->getEmailAddress();
             if (empty($email)) {
                 return false;
             } else {
                 return true;
             }
         }
     } else {
         return true;
     }
 }