You've already forked isop-mirror
feat: implement user registration email notification and add email templates
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers\Auth;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Mail\UserRegistrationCompleted;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\StudentData;
|
use App\Models\StudentData;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
@@ -11,6 +12,7 @@ use Illuminate\Http\Request;
|
|||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Hash;
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Mail;
|
||||||
|
|
||||||
class RegisteredUserController extends Controller
|
class RegisteredUserController extends Controller
|
||||||
{
|
{
|
||||||
@@ -71,10 +73,9 @@ class RegisteredUserController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mail::to($user)->sendNow(new UserRegistrationCompleted($user->name, $password));
|
||||||
event(new Registered($user));
|
event(new Registered($user));
|
||||||
|
|
||||||
Auth::login($user);
|
|
||||||
|
|
||||||
return response()->noContent();
|
return response()->noContent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use Illuminate\Bus\Queueable;
|
||||||
|
use Illuminate\Mail\Mailables\Address;
|
||||||
|
use Illuminate\Mail\Mailable;
|
||||||
|
use Illuminate\Mail\Mailables\Content;
|
||||||
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
class UserRegistrationCompleted extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
private string $name;
|
||||||
|
private string $password;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*/
|
||||||
|
public function __construct(string $name, string $password)
|
||||||
|
{
|
||||||
|
$this->name = $name;
|
||||||
|
$this->password = $password;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message envelope.
|
||||||
|
*/
|
||||||
|
public function envelope(): Envelope
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: '[ISOP] Účet vytvorený',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message content definition.
|
||||||
|
*/
|
||||||
|
public function content(): Content
|
||||||
|
{
|
||||||
|
return new Content(
|
||||||
|
view: 'mail.registration.completed',
|
||||||
|
with: [
|
||||||
|
"name" => $this->name,
|
||||||
|
"password" => $this->password
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||||
|
*/
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
@include("parts.header")
|
||||||
|
<p>Vážená/ý {{ $name }},</p>
|
||||||
|
<p>vaša registrácia do systému ISOP UKF prebehla úspešne!</p>
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<p>Vaše heslo je: <em>{{ $password }}</em></p>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<p>Ďakujeme za vašu registráciu.</p>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<p>s pozdravom</p>
|
||||||
|
<p>Systém ISOP UKF</p>
|
||||||
|
@include("parts.footer")
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
Reference in New Issue
Block a user