Example #1
0
/**
 * check the 2fa state
 * @subpackage swipe2fa/functions
 * @param $api object swipe api object
 * @param $api_config array api configuration fom the ini file
 * @param $username string username used with the api
 * @param $address string ip address from the server REMOTE_ADDR value
 * @return int api return code
 */
function get_secondfactor_state($api, $api_config, $username, $address)
{
    try {
        $resp = $api->doSecondFactor($username, $api_config["com.swipeidentity.api.appcode"], $address);
        $state = ApiBase::dispatchUser($resp);
    } catch (Exception $e) {
        $state = 0;
    }
    return $state;
}