From 1efbff8fea68bdc53a9b9c6b351e89441d191c8d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 11 Jan 2022 15:42:03 +0100 Subject: [PATCH] Fix error message --- htdocs/api/class/api_login.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 7afdb74b89d..f54fd08275a 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -135,7 +135,11 @@ class Login 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