Skip to content

Commit 2e1cbd3

Browse files
alex-montechriskacerguis
authored andcommitted
Update RestController.php
I propose this simple change so that in case $row is false, the message 'text_rest_invalid_api_key' has the information in '$this->rest->key' to display it correctly.
1 parent f386f4e commit 2e1cbd3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/RestController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,12 +867,13 @@ protected function _detect_api_key()
867867

868868
// Find the key from server or arguments
869869
if (($key = isset($this->_args[$api_key_variable]) ? $this->_args[$api_key_variable] : $this->input->server($key_name))) {
870+
871+
$this->rest->key = $key;
872+
870873
if (!($row = $this->rest->db->where($this->config->item('rest_key_column'), $key)->get($this->config->item('rest_keys_table'))->row())) {
871874
return false;
872875
}
873876

874-
$this->rest->key = $row->{$this->config->item('rest_key_column')};
875-
876877
isset($row->user_id) && $this->rest->user_id = $row->user_id;
877878
isset($row->level) && $this->rest->level = $row->level;
878879
isset($row->ignore_limits) && $this->rest->ignore_limits = $row->ignore_limits;

0 commit comments

Comments
 (0)