From d8b814270705d3084938e96ed8088cd130832adf Mon Sep 17 00:00:00 2001 From: Julian Prieber Date: Wed, 10 May 2023 16:37:07 +0200 Subject: [PATCH] Added user confirmation mail to admin email --- .../Controllers/Auth/RegisteredUserController.php | 13 +++++++++++++ resources/views/auth/user-confirmation.blade.php | 8 ++++++++ 2 files changed, 21 insertions(+) create mode 100644 resources/views/auth/user-confirmation.blade.php diff --git a/app/Http/Controllers/Auth/RegisteredUserController.php b/app/Http/Controllers/Auth/RegisteredUserController.php index 433a66c..28aecca 100755 --- a/app/Http/Controllers/Auth/RegisteredUserController.php +++ b/app/Http/Controllers/Auth/RegisteredUserController.php @@ -10,6 +10,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Mail; class RegisteredUserController extends Controller { @@ -68,6 +69,18 @@ class RegisteredUserController extends Controller $user->block = $block; $user->save(); + + $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) {} + + event(new Registered($user)); return redirect(url('dashboard')); diff --git a/resources/views/auth/user-confirmation.blade.php b/resources/views/auth/user-confirmation.blade.php new file mode 100644 index 0000000..73e393e --- /dev/null +++ b/resources/views/auth/user-confirmation.blade.php @@ -0,0 +1,8 @@ + +
+

A new user has registered on {{ str_replace(['http://', 'https://'], '', url('')) }} and is awaiting verification

+

The user {{$user}} with the email {{$email}} has registered a new account on {{ url('') }} and is awaiting confirmation by an admin. Click here to verify the user.

+
+ +

+