Skip to content

Commit 557b41a

Browse files
committed
Merge branch '4.1'
2 parents 0bb3c32 + 72c7fe2 commit 557b41a

File tree

3 files changed

+58
-29
lines changed

3 files changed

+58
-29
lines changed

src/Mail/VerificationTokenGenerated.php

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<?php
2-
2+
/**
3+
* This file is part of Jrean\UserVerification package.
4+
*
5+
* (c) Jean Ragouin <[email protected]> <www.askjong.com>
6+
*/
37
namespace Jrean\UserVerification\Mail;
48

59
use Illuminate\Bus\Queueable;
@@ -22,40 +26,44 @@ class VerificationTokenGenerated extends Mailable
2226
/**
2327
* The subject of the message.
2428
*
25-
* @var string
29+
* @var string|null
2630
*/
2731
public $subject;
2832

2933
/**
30-
* The person the message is from.
34+
* The person/company/project e-mail the message is from.
3135
*
32-
* @var mixed
36+
* @var string|null
3337
*/
34-
public $from;
38+
public $from_address;
3539

3640
/**
37-
* The person name the message is from.
41+
* The person/company/project name the message is from.
3842
*
39-
* @var mixed
43+
* @var string|null
4044
*/
41-
public $name;
45+
public $from_name;
4246

4347
/**
4448
* Create a new message instance.
4549
*
50+
* @param \Illuminate\Contracts\Auth\Authenticatable $user
51+
* @param string|null $subject
52+
* @param string|null $from_address
53+
* @param string|null $from_name
4654
* @return void
4755
*/
4856
public function __construct(
4957
AuthenticatableContract $user,
5058
$subject = null,
51-
$from = null,
52-
$name = null
59+
$from_address = null,
60+
$from_name = null
5361
)
5462
{
5563
$this->user = $user;
5664
$this->subject = $subject;
57-
$this->from = $from;
58-
$this->name = $name;
65+
$this->from_address = $from_address;
66+
$this->from_name = $from_name;
5967
}
6068

6169
/**
@@ -65,18 +73,22 @@ public function __construct(
6573
*/
6674
public function build()
6775
{
68-
if (! empty($this->from)) {
69-
$this->from($this->from, $this->name);
76+
if (! empty($this->from_address)) {
77+
$this->from($this->from_address, $this->from_name);
7078
}
7179

7280
$this->subject(is_null($this->subject)
7381
? trans('laravel-user-verification::user-verification.verification_email_subject')
7482
: $this->subject);
7583

7684
if (config('user-verification.email.type') == 'markdown') {
77-
$this->markdown('laravel-user-verification::email-markdown');
85+
is_null($view = config('user-verification.email.view'))
86+
? $this->markdown('laravel-user-verification::email-markdown')
87+
: $this->markdown($view);
7888
} else {
79-
$this->view('laravel-user-verification::email');
89+
is_null($view = config('user-verification.email.view'))
90+
? $this->view('laravel-user-verification::email')
91+
: $this->view($view);
8092
}
8193

8294
return $this;

src/UserVerification.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ protected function emailVerificationLink(
196196
)
197197
{
198198
return $this->mailer
199-
->to($user->email)
199+
->to($user)
200200
->send(new VerificationTokenGenerated($user, $subject, $from, $name));
201201
}
202202

@@ -217,7 +217,7 @@ protected function emailQueueVerificationLink(
217217
)
218218
{
219219
return $this->mailer
220-
->to($user->email)
220+
->to($user)
221221
->queue(new VerificationTokenGenerated($user, $subject, $from, $name));
222222
}
223223

@@ -240,7 +240,7 @@ protected function emailLaterVerificationLink(
240240
)
241241
{
242242
return $this->mailer
243-
->to($user->email)
243+
->to($user)
244244
->later($delay, new VerificationTokenGenerated($user, $subject, $from, $name));
245245
}
246246

src/config/user-verification.php

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,43 @@
33
return [
44

55
/*
6-
|--------------------------------------------------------------------------
7-
| Default Email View Type
8-
|--------------------------------------------------------------------------
9-
|
10-
| This option controls the default email view type.
11-
|
12-
| Supported: "default", "markdown"
6+
|---------------------------------------------------------------------------
7+
| E-mail options
8+
|---------------------------------------------------------------------------
139
|
1410
*/
1511
'email' => [
12+
/*
13+
|-----------------------------------------------------------------------
14+
| Email View Type
15+
|-----------------------------------------------------------------------
16+
|
17+
| This option defines the email view type.
18+
|
19+
| Supported: "default", "markdown"
20+
|
21+
*/
1622
'type' => 'default',
23+
24+
/*
25+
|-----------------------------------------------------------------------
26+
| Custom view name
27+
|-----------------------------------------------------------------------
28+
|
29+
| This option defines a custom view name.
30+
|
31+
*/
32+
'view' => null,
1733
],
1834

1935
/*
20-
|--------------------------------------------------------------------------
36+
|---------------------------------------------------------------------------
2137
| Log the user in after verification
22-
|--------------------------------------------------------------------------
38+
|---------------------------------------------------------------------------
2339
|
24-
| This option defines if the user should be loged in after verification.
40+
| This option defines if the user should be logged in after verification.
2541
| USE WITH CAUTION as it may introduce security issues in your app.
42+
| By default Laravel log in a new registered user.
2643
|
2744
| Supported: (bool) "true", "false"
2845
|

0 commit comments

Comments
 (0)