Disabled sending user registration emails if disabled in the config

This commit is contained in:
Julian Prieber 2023-11-24 16:35:50 +01:00
parent ff523f3f66
commit af7972d723
1 changed files with 13 additions and 9 deletions

View File

@ -73,16 +73,20 @@ class RegisteredUserController extends Controller
$user = $request->name;
$email = $request->email;
try {
Mail::send('auth.user-confirmation', ['user' => $user, 'email' => $email], function ($message) use ($user) {
$message->to(env('ADMIN_EMAIL'))
->subject('New user registration');
});
} catch (\Exception $e) {}
if(env('REGISTER_AUTH') == 'auth'){
if(env('MANUAL_USER_VERIFICATION') == true){
try {
Mail::send('auth.user-confirmation', ['user' => $user, 'email' => $email], function ($message) use ($user) {
$message->to(env('ADMIN_EMAIL'))
->subject('New user registration');
});
} catch (\Exception $e) {}
}
try {
$request->user()->sendEmailVerificationNotification();
} catch (\Exception $e) {}
try {
$request->user()->sendEmailVerificationNotification();
} catch (\Exception $e) {}
}
event(new Registered($user));