mirror of
https://github.com/devcode-it/openstamanager.git
synced 2024-12-27 08:12:47 +01:00
Fix login API
This commit is contained in:
parent
c8a6f2d4d2
commit
82c117d94b
@ -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');
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user