1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-26 15:54:17 +01:00

Fix login API

This commit is contained in:
Luca 2018-05-15 15:15:24 +02:00
parent c8a6f2d4d2
commit 82c117d94b
2 changed files with 9 additions and 2 deletions

View File

@ -62,7 +62,14 @@ try {
break;
}
} catch (InvalidArgumentException $e) {
$result = API::error('unauthorized');
if (Auth::getInstance()->attempt(post('username'), post('password'))) {
$token = Auth::getInstance()->getToken();
$result = $token;
}else{
$result = API::error('unauthorized');
}
} catch (Exception $e) {
$result = API::error('serverError');
}

View File

@ -3,7 +3,7 @@
switch ($resource) {
case 'login':
// Controllo sulle credenziali
if (Auth::getInstance()->attempt($request['username'], $request['password'])) {
if (Auth::getInstance()->attempt(post('username'), post('password'))) {
$token = Auth::getInstance()->getToken();
// Informazioni da restituire tramite l'API