Added user confirmation mail to admin email

This commit is contained in:
Julian Prieber 2023-05-10 16:37:07 +02:00
parent 668f246179
commit d8b8142707
2 changed files with 21 additions and 0 deletions

View File

@ -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'));

View File

@ -0,0 +1,8 @@
<x-guest-layout>
<div class="mb-4 text-sm text-gray-600">
<h2>A new user has registered on {{ str_replace(['http://', 'https://'], '', url('')) }} and is awaiting verification</h2>
<p>The user <i>{{$user}}</i> with the email <i>{{$email}}</i> has registered a new account on {{ url('') }} and is awaiting confirmation by an admin. Click <a href="{{ url('admin/users/all') }}">here</a> to verify the user.</p>
</div>
<a href="{{ url('admin/users/all') }}"><button>Manage users</button></a>
<br><br>
</x-guest-layout>