public function Validate() { include 'class.password.validator.php'; $pwdValidator = new PasswordValidator(); if ($pwdValidator->Validate($this->_data)->isValidated()) { $this->_response = array("response" => array("message" => "Password changed successfully.")); return true; } else { $this->_response = array("response" => array("message" => $pwdValidator->getMessage())); return false; } }
public function testPasswordValidatorComparesStoredPasswordAgainstProvidedPassword() { $passwordEncryption = new PasswordEncryption(); $salt = $passwordEncryption->Salt(); $current = "some password"; $user = new User(); $encrypted = $passwordEncryption->Encrypt($current, $salt); $user->encryptedPassword = $encrypted; $user->passwordSalt = $salt; $validator = new PasswordValidator($current, $user); $validator->Validate(); $this->assertTrue($validator->IsValid()); }