コード例 #1
0
ファイル: Summary.php プロジェクト: laiello/resmania
 private function _terms_summary_validate()
 {
     $validatorChain = new RM_Validate('Terms');
     $result = $validatorChain->addValidator(new Zend_Validate_NotEmpty())->isValid($this->_request->getParam('terms', null));
     if (!$result) {
         $this->_errors = array_merge($this->_errors, $validatorChain->getErrors());
     }
     return $result;
 }
コード例 #2
0
ファイル: Login.php プロジェクト: laiello/resmania
 /**
  * IMPORTANT side effect. This method will automatically authenticate using to CMS if
  * enable_cms_integration is on in config.
  *
  * @param Zend_Request_Interface $request
  * @return bool
  */
 function validate($request)
 {
     $result = true;
     //We check username for alphanumeric
     $username = $request->getParam('username', null);
     $validatorChain = new RM_Validate('Username');
     $usernameResult = $validatorChain->addValidator(new Zend_Validate_Alnum())->isValid($username);
     if (!$usernameResult) {
         $this->_errors = $validatorChain->getErrors();
         $result = false;
     }
     //We check password for alphanumeric
     $password = $request->getParam('password', null);
     $validatorChain = new RM_Validate('Password');
     $passwordResult = $validatorChain->addValidator(new Zend_Validate_Alnum())->isValid($password);
     if (!$passwordResult) {
         $this->_errors = array_merge($this->_errors, $validatorChain->getErrors());
         $result = false;
     }
     $config = new RM_Config();
     $isCmsAuthentication = $config->getValue('rm_config_enable_cms_integration');
     if ($isCmsAuthentication) {
         $authenticationResult = RM_Environment::getConnector()->authenticate($request->getParam('username'), $request->getParam('password'));
         if ($authenticationResult !== true) {
             if (is_object($authenticationResult)) {
                 $this->_errors[] = $authenticationResult->getMessage();
             } else {
                 $this->_errors[] = 'UserNotFound';
             }
             $result = false;
         }
     } else {
         $userModel = new RM_Users();
         $user = $userModel->getBy($request->getParam('username'));
         if ($user === null) {
             $this->_errors[] = 'UserNotFound';
             $result = false;
         }
         //Finally we tries to find existing user in database with the same username/password
         $userModel = new RM_Users();
         $user = $userModel->getBy($request->getParam('username'), $request->getParam('password'));
         if ($user === null) {
             $this->_errors[] = 'WrongPassword';
             $result = false;
         }
     }
     return $result;
 }
コード例 #3
0
ファイル: Userdetails.php プロジェクト: laiello/resmania
 /**
  * Username should be non empty and alpha numeric
  *
  * @return bool
  */
 private function _username_user_validate()
 {
     $validatorChain = new RM_Validate('Username');
     $result = $validatorChain->addValidator(new Zend_Validate_Alnum())->isValid($this->_request->getParam('username', null));
     if (!$result) {
         $this->_errors = array_merge($this->_errors, $validatorChain->getErrors());
     }
     return $result;
 }