API - Se è in corso un brute-force, aggiunge il timeout

This commit is contained in:
Luca 2018-05-15 15:47:13 +02:00
parent 82c117d94b
commit c365d94081
1 changed files with 5 additions and 2 deletions

View File

@ -64,10 +64,13 @@ try {
} catch (InvalidArgumentException $e) { } catch (InvalidArgumentException $e) {
if (Auth::getInstance()->attempt(post('username'), post('password'))) { if (Auth::getInstance()->attempt(post('username'), post('password'))) {
$token = Auth::getInstance()->getToken(); $result = Auth::getInstance()->getToken();
$result = $token;
}else{ }else{
$result = API::error('unauthorized'); $result = API::error('unauthorized');
// Se è in corso un brute-force, aggiunge il timeout
if (Auth::isBrute()) {
$result = Auth::getBruteTimeout();
}
} }
} catch (Exception $e) { } catch (Exception $e) {