Skip to content

Commit 951d943

Browse files
committed
resend verification email if necessary
1 parent bcbaeba commit 951d943

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

stubs/UpdateUserProfileInformation.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Actions\Fortify;
44

5+
use Illuminate\Contracts\Auth\MustVerifyEmail;
56
use Illuminate\Support\Facades\Validator;
67
use Illuminate\Validation\Rule;
78
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;
@@ -29,19 +30,15 @@ public function update($user, array $input)
2930
],
3031
])->validateWithBag('updateProfileInformation');
3132

32-
if ($input['email'] != $user->email & new User instanceof MustVerifyEmail) {
33-
$user->forceFill([
34-
'name' => $input['name'],
35-
'email' => $input['email'],
36-
// 'email_verified_at' => null, // If uncommented, this will force user to verify email before being able to navigate to any route requiring auth
37-
])->save();
38-
33+
if ($input['email'] !== $user->email &&
34+
$user instanceof MustVerifyEmail) {
3935
$user->sendEmailVerificationNotification();
40-
} else {
41-
$user->forceFill([
42-
'name' => $input['name'],
43-
'email' => $input['email'],
44-
])->save();
4536
}
37+
38+
$user->forceFill([
39+
'name' => $input['name'],
40+
'email' => $input['email'],
41+
'email_verified_at' => null,
42+
])->save();
4643
}
4744
}

0 commit comments

Comments
 (0)