WIP: Road to 1.0.0 #1

Draft
miguel456 wants to merge 123 commits from develop into master
2 changed files with 35 additions and 0 deletions
Showing only changes of commit 3b28bf1cfe - Show all commits

View File

@ -25,6 +25,7 @@ use App\Http\Controllers\Controller;
use App\User; use App\User;
use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class LoginController extends Controller class LoginController extends Controller
{ {
@ -77,4 +78,17 @@ class LoginController extends Controller
return $this->originalAttemptLogin($request); return $this->originalAttemptLogin($request);
} }
public function authenticated(Request $request, User $user)
{
if ($user->originalIP !== $request->ip())
{
Log::alert('User IP address changed from last login. Updating.', [
'prev' => $user->originalIP,
'new' => $request->ip()
]);
$user->originalIP = $request->ip();
$user->save();
}
}
} }

View File

@ -0,0 +1,21 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class IPHistoryMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
return $next($request);
}
}