public function login()
{
$ip = Request::getClientIp();
if (LoginAttempt::isLocked($ip)) {
return error_popup('your IP address is locked. Please wait a few minutes.');
} else {
$username = Request::input('username');
$password = Request::input('password');
$remember = Request::input('remember') === 'yes';
Auth::attempt(['username' => $username, 'password' => $password], $remember);
if (Auth::check()) {
return Auth::user()->defaultJson();
} else {
LoginAttempt::failedAttempt($ip, $username);
return error_popup('wrong password or username');
}
}
}