From fe2fe0b2477d67f8cdb5331d9cd859208a3d1b54 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: Fri, 28 Jan 2022 22:18:44 +0900 Subject: [PATCH] =?UTF-8?q?=E5=AD=90=E3=81=AEtel=5Factivations=E3=81=AE?= =?UTF-8?q?=E6=9C=89=E5=8A=B9=E6=9C=9F=E9=99=90=E3=81=8C=E5=88=87=E3=82=8C?= =?UTF-8?q?=E3=81=9F=E3=81=AB=E3=82=82=E3=81=8B=E5=A4=89=E3=82=8F=E3=82=89?= =?UTF-8?q?=E3=81=9A=E3=80=81=E3=83=87=E3=83=BC=E3=82=BF=E3=81=8C=E5=89=8A?= =?UTF-8?q?=E9=99=A4=E3=81=95=E3=82=8C=E3=81=BE=E3=81=9B=E3=82=93=E3=80=82?= =?UTF-8?q?email=5Factivations=E3=82=82=E5=90=8C=E6=A7=98=E3=81=8B?= =?UTF-8?q?=E3=81=A8=E6=80=9D=E3=81=84=E3=81=BE=E3=81=99=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/Http/Controllers/Api/ChildrenController.php | 8 +++++++- backend/app/Http/Controllers/Api/FathersController.php | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/backend/app/Http/Controllers/Api/ChildrenController.php b/backend/app/Http/Controllers/Api/ChildrenController.php index be21046f..03f5d927 100644 --- a/backend/app/Http/Controllers/Api/ChildrenController.php +++ b/backend/app/Http/Controllers/Api/ChildrenController.php @@ -96,7 +96,13 @@ class ChildrenController extends Controller { public function checkRegisterMain (Request $r) { // トークンの確認 - if (null === ($get = TelActivation::select('tel')->where('token', $r->token)->first())) { + if (null === ($get = TelActivation::select('tel', 'ttl')->where('token', $r->token)->first())) { + return ['status_code' => 400, 'error_messages' => ['不正な登録トークン。']]; + } + + // トークンの有効期限が切れた場合 + if (time() > strtotime($get->ttl)) { + TelActivation::where('token', $r->token)->delete(); return ['status_code' => 400, 'error_messages' => ['不正な登録トークン。']]; } diff --git a/backend/app/Http/Controllers/Api/FathersController.php b/backend/app/Http/Controllers/Api/FathersController.php index a446d388..7d3d037b 100644 --- a/backend/app/Http/Controllers/Api/FathersController.php +++ b/backend/app/Http/Controllers/Api/FathersController.php @@ -142,7 +142,13 @@ class FathersController extends Controller { public function checkRegisterMain (Request $r) { // トークンの確認 - if (null === ($get = EmailActivation::where('token', $r->token)->first())) { + if (null === ($get = EmailActivation::select('ttl')where('token', $r->token)->first())) { + return ['status_code' => 400, 'error_messages' => ['不正な登録トークン。']]; + } + + // トークンの有効期限が切れた場合 + if (time() > strtotime($get->ttl)) { + EmailActivation::where('token', $r->token)->delete(); return ['status_code' => 400, 'error_messages' => ['不正な登録トークン。']]; }