Hello i am having a REST API build with CodeIgniter using https://github.com/chriskacerguis/codeigniter-restserver/blob/master/application/libraries/REST_Controller.php.
In _detect_api_key() function he only checks if given Api Key matches the one stored in the table. I modified a bit this method and check not only if the api key matches but also if the user is activated. For both situations i get Invalid API Key message.
How can i set the message to "The API Key you are using is not active" or something similar?
The file i am using for error messages is this:
/*
* English language
*/
$lang['text_rest_invalid_api_key'] = 'Invalid API key %s'; // %s is the REST API key
$lang['text_rest_invalid_credentials'] = 'Invalid credentials';
$lang['text_rest_ip_denied'] = 'IP denied';
$lang['text_rest_ip_unauthorized'] = 'IP unauthorized';
$lang['text_rest_unauthorized'] = 'Unauthorized';
$lang['text_rest_ajax_only'] = 'Only AJAX requests are allowed';
$lang['text_rest_api_key_unauthorized'] = 'This API key does not have access to the requested controller';
$lang['text_rest_api_key_permissions'] = 'This API key does not have enough permissions';
$lang['text_rest_api_key_time_limit'] = 'This API key has reached the time limit for this method';
$lang['text_rest_unknown_method'] = 'Unknown method';
$lang['text_rest_unsupported'] = 'Unsupported protocol';
and in _detect_api_key method does not mention anything about error messages just returns false:
if ( !($row = $this->rest->db->where($this->config->item('rest_key_column'), $key)->get($this->config->item('rest_keys_table'))->row()) || $isactive[0]->activated === 'no' )
{
return FALSE;
}
i added this:
$isactive[0]->activated === 'no'
Any ideas?