mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +00:00
Fixed error in login process of the API
This commit is contained in:
parent
dee769d5a4
commit
900c7c7e5e
@ -30,7 +30,7 @@ class userController
|
|||||||
//Try to perform login
|
//Try to perform login
|
||||||
$loginTokens = CS::get()->components->user->generateUserLoginTokens($userMail, $userPassword, APIServiceID, $db);
|
$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 !");
|
throw new RestException(401, "Invalid e-mail address / password !");
|
||||||
|
|
||||||
//Return result with tokens
|
//Return result with tokens
|
||||||
|
@ -43,7 +43,7 @@ class User{
|
|||||||
|
|
||||||
//Check if there is anything
|
//Check if there is anything
|
||||||
if(count($userInfos) == 0)
|
if(count($userInfos) == 0)
|
||||||
return false; //Not any account was found
|
return array(); //Not any account was found
|
||||||
|
|
||||||
//Extract first value ID
|
//Extract first value ID
|
||||||
$userID = $userInfos[0]['ID'];
|
$userID = $userInfos[0]['ID'];
|
||||||
@ -69,7 +69,7 @@ class User{
|
|||||||
"token2" => $token2
|
"token2" => $token2
|
||||||
);
|
);
|
||||||
if(!CS::get()->db->addLine($tableName, $insertValues))
|
if(!CS::get()->db->addLine($tableName, $insertValues))
|
||||||
return false; //Something went wrong
|
return array(); //Something went wrong
|
||||||
|
|
||||||
//We can return tokens
|
//We can return tokens
|
||||||
return array($token1, $token2);
|
return array($token1, $token2);
|
||||||
|
Loading…
Reference in New Issue
Block a user