Skip to content

Commit af7972d

Browse files
committed
Disabled sending user registration emails if disabled in the config
1 parent ff523f3 commit af7972d

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

app/Http/Controllers/Auth/RegisteredUserController.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,20 @@ public function store(Request $request)
7373
$user = $request->name;
7474
$email = $request->email;
7575

76+
if(env('REGISTER_AUTH') == 'auth'){
77+
if(env('MANUAL_USER_VERIFICATION') == true){
78+
try {
79+
Mail::send('auth.user-confirmation', ['user' => $user, 'email' => $email], function ($message) use ($user) {
80+
$message->to(env('ADMIN_EMAIL'))
81+
->subject('New user registration');
82+
});
83+
} catch (\Exception $e) {}
84+
}
85+
7686
try {
77-
Mail::send('auth.user-confirmation', ['user' => $user, 'email' => $email], function ($message) use ($user) {
78-
$message->to(env('ADMIN_EMAIL'))
79-
->subject('New user registration');
80-
});
81-
} catch (\Exception $e) {}
82-
83-
try {
84-
$request->user()->sendEmailVerificationNotification();
85-
} catch (\Exception $e) {}
87+
$request->user()->sendEmailVerificationNotification();
88+
} catch (\Exception $e) {}
89+
}
8690

8791
event(new Registered($user));
8892

0 commit comments

Comments
 (0)