-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main'
- Loading branch information
Showing
5 changed files
with
129 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace Javaabu\Auth\Mail; | ||
|
||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Mail\Mailable; | ||
use Illuminate\Queue\SerializesModels; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
|
||
class EmailUpdated extends Mailable | ||
{ | ||
use Queueable; | ||
use SerializesModels; | ||
|
||
protected $user; | ||
|
||
/** | ||
* The new email | ||
* | ||
* @var string | ||
*/ | ||
public $new_email; | ||
|
||
/** | ||
* Create a new message instance. | ||
* @param $user | ||
* @param $new_email | ||
*/ | ||
public function __construct($user, $new_email) | ||
{ | ||
$this->user = $user; | ||
$this->new_email = $new_email; | ||
} | ||
|
||
/** | ||
* Build the message. | ||
* | ||
* @return $this | ||
*/ | ||
public function build() | ||
{ | ||
$message = (new MailMessage()) | ||
->greeting("Hi {$this->user->name},") | ||
->line("We have updated your email address to {$this->new_email}.") | ||
->line('You can no longer login using your old email address.') | ||
->line('If you did not make this request, contact us immediately.'); | ||
|
||
return $this->markdown('vendor.notifications.email')->with($message->data()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
<?php | ||
|
||
namespace Javaabu\Auth\Mail; | ||
|
||
use Javaabu\Auth\User; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Mail\Mailable; | ||
use Illuminate\Support\Carbon; | ||
use Illuminate\Support\Facades\URL; | ||
use Illuminate\Support\Facades\Lang; | ||
use Illuminate\Queue\SerializesModels; | ||
use Illuminate\Support\Facades\Config; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
|
||
class NewEmailVerification extends Mailable | ||
{ | ||
use Queueable; | ||
use SerializesModels; | ||
|
||
/** | ||
* @var User $user | ||
*/ | ||
protected $user; | ||
|
||
/** | ||
* Create a new message instance. | ||
* | ||
* @param User $user | ||
*/ | ||
public function __construct(User $user) | ||
{ | ||
$this->user = $user; | ||
} | ||
|
||
/** | ||
* Build the message. | ||
* | ||
* @return $this | ||
*/ | ||
public function build() | ||
{ | ||
$verificationUrl = $this->verificationUrl($this->user); | ||
|
||
$message = (new MailMessage()) | ||
->subject(Lang::get('Verify New Email Address')) | ||
->greeting(Lang::get('Hi :user,', ['user' => $this->user->name])) | ||
->line(Lang::get('You are receiving this email since you have requested to update your email address to this new email.')) | ||
->line(Lang::get('Please click the button below to verify your new email address.')) | ||
->action(Lang::get('Verify New Email Address'), $verificationUrl) | ||
->line(Lang::get('If you did not request to update your email, no further action is required.')); | ||
|
||
return $this->markdown('vendor.notifications.email')->with($message->data()); | ||
} | ||
|
||
/** | ||
* Get the verification URL for the given user. | ||
* | ||
* @param User $user | ||
* @return string | ||
*/ | ||
protected function verificationUrl(User $user) | ||
{ | ||
return URL::temporarySignedRoute( | ||
$user->getRouteForEmailVerification(), | ||
Carbon::now()->addMinutes(Config::get('auth.verification.expire', 60)), | ||
[ | ||
'id' => $user->getKey(), | ||
'hash' => sha1($user->getEmailForVerification()), | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters