Add user logging after WebAuthn authentication - Fix #109

This commit is contained in:
Bubka 2022-08-02 10:57:16 +02:00
parent 855f16a8a1
commit 3f279f358c
2 changed files with 17 additions and 1 deletions

View File

@ -6,6 +6,7 @@
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use DarkGhostHunter\Larapass\Http\AuthenticatesWebAuthn;
use Carbon\Carbon;
class WebAuthnLoginController extends Controller
{
@ -73,4 +74,19 @@ public function login(Request $request)
return $this->traitLogin($request);
}
/**
* The user has been authenticated.
*
* @param \Illuminate\Http\Request $request
* @param mixed $user
*
* @return void|\Illuminate\Http\JsonResponse
*/
protected function authenticated(Request $request, $user)
{
$user->last_seen_at = Carbon::now()->format('Y-m-d H:i:s');
$user->save();
}
}

View File

@ -16,7 +16,7 @@ class LogUserLastSeen
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, ...$quards)
public function handle($request, Closure $next, ...$guards)
{
$guards = empty($guards) ? [null] : $guards;