Merge branch '14.0' of git@github.com:Dolibarr/dolibarr.git into 15.0

This commit is contained in:
Laurent Destailleur 2022-01-12 10:58:24 +01:00
commit d3af00d4e6

View File

@ -137,7 +137,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