Skip to content

Commit

Permalink
resend verification email if necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Sep 18, 2020
1 parent bcbaeba commit 951d943
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions stubs/UpdateUserProfileInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Actions\Fortify;

use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
Expand Down Expand Up @@ -29,19 +30,15 @@ public function update($user, array $input)
],
])->validateWithBag('updateProfileInformation');

if ($input['email'] != $user->email & new User instanceof MustVerifyEmail) {
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
// 'email_verified_at' => null, // If uncommented, this will force user to verify email before being able to navigate to any route requiring auth
])->save();

if ($input['email'] !== $user->email &&
$user instanceof MustVerifyEmail) {
$user->sendEmailVerificationNotification();
} else {
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
])->save();
}

$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
'email_verified_at' => null,
])->save();
}
}

0 comments on commit 951d943

Please sign in to comment.