Skip to content

Commit bd1895b

Browse files
committed
Merge branch 'dev' into feature/profile-page
2 parents ad2db8c + 3f04137 commit bd1895b

File tree

8 files changed

+183
-80
lines changed

8 files changed

+183
-80
lines changed

backend/.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ MAIL_PORT=2525
2929
MAIL_USERNAME=null
3030
MAIL_PASSWORD=null
3131
MAIL_ENCRYPTION=null
32+
MAIL_FROM_ADDRESS=
33+
MAIL_FROM_NAME=
3234

3335
AWS_ACCESS_KEY_ID=
3436
AWS_SECRET_ACCESS_KEY=
@@ -48,3 +50,5 @@ JWT_SECRET=
4850
MYSQL_PORT=33061
4951
APP_PORT=7777
5052
MYSQL_PORT_TEST_DB=33062
53+
54+
BEANSTALKD_HOST=

backend/app/Action/Auth/RegisterAction.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@
55
namespace App\Action\Auth;
66

77
use App\Repository\UserRepository;
8+
use Illuminate\Mail\Mailer;
9+
use App\Mail\WelcomeEmail;
810

911
final class RegisterAction
1012
{
1113
private $userRepository;
14+
private $mailer;
1215

13-
public function __construct(UserRepository $userRepository)
16+
public function __construct(UserRepository $userRepository, Mailer $mailer)
1417
{
1518
$this->userRepository = $userRepository;
19+
$this->mailer = $mailer;
1620
}
1721

1822
public function execute(RegisterRequest $request): AuthenticationResponse
@@ -24,13 +28,14 @@ public function execute(RegisterRequest $request): AuthenticationResponse
2428
'last_name' => $request->getLastName(),
2529
'nickname' => $request->getNickname()
2630
]);
27-
2831
$token = auth()->login($user);
2932

33+
$this->mailer->to($user)->send(new WelcomeEmail());
34+
3035
return new AuthenticationResponse(
3136
$token,
3237
'bearer',
3338
auth()->factory()->getTTL() * 60
3439
);
3540
}
36-
}
41+
}

backend/app/Mail/WelcomeEmail.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace App\Mail;
4+
5+
use Illuminate\Bus\Queueable;
6+
use Illuminate\Mail\Mailable;
7+
use Illuminate\Queue\SerializesModels;
8+
use Illuminate\Contracts\Queue\ShouldQueue;
9+
10+
class WelcomeEmail extends Mailable implements ShouldQueue
11+
{
12+
use Queueable, SerializesModels;
13+
14+
/**
15+
* Build the message.
16+
*
17+
* @return $this
18+
*/
19+
public function build()
20+
{
21+
return $this->subject('Welcome!')->view('emails.welcome');
22+
}
23+
}

backend/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"fideloper/proxy": "^4.0",
1717
"laravel/framework": "5.8.*",
1818
"laravel/tinker": "^1.0",
19+
"pda/pheanstalk": "^4.0",
1920
"tymon/jwt-auth": "1.0.*"
2021
},
2122
"require-dev": {

0 commit comments

Comments
 (0)