Skip to content

Commit

Permalink
Fix error message
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 11, 2022
1 parent 5d5a219 commit 1efbff8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion htdocs/api/class/api_login.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ public function index($login, $password, $entity = '', $reset = 0)
if (empty($tmpuser->api_key) || $reset) {
$tmpuser->getrights();
if (empty($tmpuser->rights->user->self->creer)) {
throw new RestException(403, 'User need write permission on itself to reset its API token');
if (empty($tmpuser->api_key)) {
throw new RestException(403, 'No API token set for this user and user need write permission on itself to reset its API token');
} else {
throw new RestException(403, 'User need write permission on itself to reset its API token');
}
}

// Generate token for user
Expand Down

0 comments on commit 1efbff8

Please sign in to comment.