From f7b6362c6e46e759859a048cef02ff59a172329b Mon Sep 17 00:00:00 2001 From: Ali Nazari Date: Sat, 5 Jan 2019 13:27:28 +0330 Subject: [PATCH 1/2] Stop email reverification with same link If a user reopen the given email verification link, the `email_verified_at` column is being updated. While in should not be updated when the email is verified before (by same provided link). --- src/Illuminate/Foundation/Auth/VerifiesEmails.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Illuminate/Foundation/Auth/VerifiesEmails.php b/src/Illuminate/Foundation/Auth/VerifiesEmails.php index 4b252343630e..b30397eb83c6 100644 --- a/src/Illuminate/Foundation/Auth/VerifiesEmails.php +++ b/src/Illuminate/Foundation/Auth/VerifiesEmails.php @@ -35,6 +35,10 @@ public function verify(Request $request) if ($request->route('id') != $request->user()->getKey()) { throw new AuthorizationException; } + + if ($request->user()->hasVerifiedEmail()) { + return redirect($this->redirectPath()); + } if ($request->user()->markEmailAsVerified()) { event(new Verified($request->user())); From be70858192281f00006adc1a76c5e136476063f4 Mon Sep 17 00:00:00 2001 From: Ali Nazari Date: Sat, 5 Jan 2019 13:33:12 +0330 Subject: [PATCH 2/2] Stop email re-verification with same link If a user reopen the given email verification link, the `email_verified_at` column is being updated. While in should not be updated when the email is verified before (by same provided link). --- src/Illuminate/Foundation/Auth/VerifiesEmails.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Auth/VerifiesEmails.php b/src/Illuminate/Foundation/Auth/VerifiesEmails.php index b30397eb83c6..74e74ed0982f 100644 --- a/src/Illuminate/Foundation/Auth/VerifiesEmails.php +++ b/src/Illuminate/Foundation/Auth/VerifiesEmails.php @@ -35,7 +35,7 @@ public function verify(Request $request) if ($request->route('id') != $request->user()->getKey()) { throw new AuthorizationException; } - + if ($request->user()->hasVerifiedEmail()) { return redirect($this->redirectPath()); }