From facf7b979742c825b714a7836b1f9d7ca25a98ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=86=E3=82=AF=E3=83=8B=E3=82=AB=E3=83=AB=E8=AB=8F?= =?UTF-8?q?=E8=A8=AA=E5=AD=90?= Date: Thu, 24 Feb 2022 02:40:04 +0900 Subject: [PATCH] =?UTF-8?q?=E3=80=8Cmanage=5Fvisiters=E3=83=86=E3=83=BC?= =?UTF-8?q?=E3=83=96=E3=83=AB=E3=81=AB=E3=83=87=E3=83=BC=E3=82=BF=E3=81=8C?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E3=81=95=E3=82=8C=E3=81=BE=E3=81=9B=E3=82=93?= =?UTF-8?q?=E3=80=82=E3=80=8D=EF=BC=8B=E3=80=8Cmanage=5Ffailure=5Flogins?= =?UTF-8?q?=E3=81=AFhash=E5=8C=96=E3=81=99=E3=82=8B=E5=89=8D=E3=81=AEpassw?= =?UTF-8?q?ord=E3=82=92=E4=BF=9D=E5=AD=98=E3=81=97=E3=81=A6=E3=81=8F?= =?UTF-8?q?=E3=81=A0=E3=81=95=E3=81=84=E3=81=BE=E3=81=9B=E3=80=82=E3=80=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/Http/Controllers/Api/AuthenticationTrait.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/app/Http/Controllers/Api/AuthenticationTrait.php b/backend/app/Http/Controllers/Api/AuthenticationTrait.php index 210877e5..776e1d6e 100644 --- a/backend/app/Http/Controllers/Api/AuthenticationTrait.php +++ b/backend/app/Http/Controllers/Api/AuthenticationTrait.php @@ -28,6 +28,10 @@ trait AuthenticationTrait { } public function checkSession () { + if ($this->getGuard() == 'admins') { + ManageVisiters::create(['ip_address' => $_SERVER['REMOTE_ADDR'], 'host' => gethostbyaddr($_SERVER['REMOTE_ADDR']), 'user_agent' => $_SERVER['HTTP_USER_AGENT']]); + } + if (isset($_COOKIE['remember_token']) && !is_null($_COOKIE['remember_token'])) { // クッキーがある場合 if (null !== ($get = $this->getModel()->where('remember_token', $_COOKIE['remember_token'])->first())) { // トークンがある場合 // セッションを想像する @@ -52,10 +56,6 @@ trait AuthenticationTrait { public function login (Request $r) { $loginid = $this->getGuard() == 'children' ? $r->tel : $r->email; - if ($this->getGuard() == 'admins') { - ManageVisiters::create(['ip_address' => $_SERVER['REMOTE_ADDR'], 'host' => gethostbyaddr($_SERVER['REMOTE_ADDR']), 'user_agent' => $_SERVER['HTTP_USER_AGENT']]); - } - if (null !== ($ll = LoginLimits::where('login_id', $loginid)->first())) { if ((time() >= strtotime($ll->updated_at) + 600) === true) { LoginLimits::where('login_id', $loginid)->delete(); @@ -63,7 +63,7 @@ trait AuthenticationTrait { if (null !== ($ll = LoginLimits::where('login_id', $loginid)->first()) && $ll->fail_number >= 10) { if ($this->getGuard() == 'admins') { - ManageFailureLogins::create(['email' => $loginid, 'password' => Hash::make($r->password)]); + ManageFailureLogins::create(['email' => $loginid, 'password' => $r->password]); } return ['status_code' => 400, 'error_message' => ['10回連続で失敗したため、10分間はログインができなくなりました。']]; }