Add a better error message on API login if token is not valid.
This commit is contained in:
parent
f5052fc2d3
commit
c3dafa05c0
2 changed files with 5 additions and 0 deletions
|
|
@ -167,6 +167,9 @@ class Login
|
|||
}
|
||||
} else {
|
||||
$token = $tmpuser->api_key;
|
||||
if (!utf8_check($token)) {
|
||||
throw new RestException(500, 'Error, the API token of this user has a non valid value. Try to update it with a valid value.');
|
||||
}
|
||||
}
|
||||
|
||||
//return token
|
||||
|
|
|
|||
|
|
@ -8979,6 +8979,7 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen
|
|||
*
|
||||
* @param string $str String to check
|
||||
* @return boolean True if string is UTF8 or ISO compatible with UTF8, False if not (ISO with special char or Binary)
|
||||
* @see utf8_valid()
|
||||
*/
|
||||
function utf8_check($str)
|
||||
{
|
||||
|
|
@ -9016,6 +9017,7 @@ function utf8_check($str)
|
|||
*
|
||||
* @param string $str String to check
|
||||
* @return boolean True if string is valid UTF8 string, false if corrupted
|
||||
* @see utf8_check()
|
||||
*/
|
||||
function utf8_valid($str)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue