Fixed error in login process of the API

This commit is contained in:
Pierre 2017-10-31 14:25:33 +01:00
parent dee769d5a4
commit 900c7c7e5e
2 changed files with 3 additions and 3 deletions

View File

@ -30,7 +30,7 @@ class userController
//Try to perform login
$loginTokens = CS::get()->components->user->generateUserLoginTokens($userMail, $userPassword, APIServiceID, $db);
if(!$loginTokens)
if(count($loginTokens) == 0)
throw new RestException(401, "Invalid e-mail address / password !");
//Return result with tokens

View File

@ -43,7 +43,7 @@ class User{
//Check if there is anything
if(count($userInfos) == 0)
return false; //Not any account was found
return array(); //Not any account was found
//Extract first value ID
$userID = $userInfos[0]['ID'];
@ -69,7 +69,7 @@ class User{
"token2" => $token2
);
if(!CS::get()->db->addLine($tableName, $insertValues))
return false; //Something went wrong
return array(); //Something went wrong
//We can return tokens
return array($token1, $token2);