Skip to content
Snippets Groups Projects
Commit e679c0f8 authored by Andrew Hoffmann's avatar Andrew Hoffmann
Browse files

checkAnswers now requires an IP address because Middleware web service

requires one.
parent 17b9d7df
No related branches found
No related tags found
No related merge requests found
......@@ -47,11 +47,11 @@ interface RpcNetidClient {
* Validates the answers to the NetID security questions for a given user
* @param string $uid the uid of the user to search for (typically the NetID)
* @param RpcNetidStructQuestion[] $questions array containing security questions for the user (Number and Answer required)
* @param string $ip ip address of the user (optional)
* @param string $ip ip address of the user
* @return bool true if the answers are correct, false otherwise
* @throws edu\wisc\doit\RpcNetidClientSoapException if unexpected response from web service
*/
function checkAnswers ( $uid, array $questions, $ip = "" );
function checkAnswers ( $uid, array $questions, $ip );
/**
* Retrieves the recovery email attached to the given user's uid
......
......@@ -189,23 +189,21 @@ class RpcNetidClientSoap implements RpcNetidClient {
* (non-PHPdoc)
* @see \edu\wisc\doit\RpcNetidClient::checkAnswers()
*/
public function checkAnswers( $uid, array $questions, $ip = "" ){
public function checkAnswers( $uid, array $questions, $ip ){
if( is_string($uid) !== true) {
throw new \InvalidArgumentException("uid parameter must be a string");
}
if ( empty( $ip ) === false ) {
if ( is_string( $ip ) !== true) {
throw new \InvalidArgumentException("ip parameter must be a string");
}
if ( filter_var( $ip, FILTER_VALIDATE_IP ) === false ) {
throw new \DomainException( "Invalid IP address: $ip" );
}
if ( is_string( $ip ) !== true) {
throw new \InvalidArgumentException("ip parameter must be a string");
}
if ( filter_var( $ip, FILTER_VALIDATE_IP ) === false ) {
throw new \DomainException( "Invalid IP address: $ip" );
}
// Create array of parameters for the SOAP client
$questionsParam = array( 'QuestionPair' => array() );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment