コード例 #1
0
 /**
  * Returns true if and only if $value meets the validation requirements
  *
  * If $value fails validation, then this method returns false, and
  * getMessages() will return an array of messages that explain why the
  * validation failed.
  *
  * @param  mixed $value
  * @param  mixed $content
  * @return boolean
  * @throws \Zend_Validate_Exception If validation of $value is impossible
  */
 public function isValid($value, $context = array())
 {
     $this->_message = null;
     $user = $this->_userSource->getUser();
     if (!($user->isActive() && $user->canResetPassword() && $user->isAllowedOrganization($context['organization']))) {
         $this->_message = $this->translate->_('User not found or no e-mail address known or user cannot be reset.');
     }
     return (bool) (!$this->_message);
 }
コード例 #2
0
 /**
  * Returns true if and only if $value meets the validation requirements
  *
  * If $value fails validation, then this method returns false, and
  * getMessages() will return an array of messages that explain why the
  * validation failed.
  *
  * @param  mixed $value
  * @param  mixed $content
  * @return boolean
  * @throws \Zend_Validate_Exception If validation of $value is impossible
  */
 public function isValid($value, $context = array())
 {
     $user = $this->_userSource->getUser();
     if ($user instanceof \Gems_User_User) {
         $result = $user->authenticate($value);
     } else {
         $result = new \Zend_Auth_Result(\Zend_Auth_Result::FAILURE_UNCATEGORIZED, null);
     }
     return $this->setAuthResult($result);
 }