-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
767228c
commit abd6e19
Showing
14 changed files
with
223 additions
and
60 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
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,36 @@ | ||
<?php | ||
|
||
namespace MHMartinez\TwoFactorAuth\app\Notifications; | ||
|
||
use Closure; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
use Illuminate\Notifications\Notification; | ||
use Illuminate\Support\HtmlString; | ||
|
||
class ResetTwoFactorAuth extends Notification | ||
{ | ||
public static ?Closure $toMailCallback; | ||
|
||
public function __construct(private readonly string $token) | ||
{ | ||
} | ||
|
||
public function via(): array | ||
{ | ||
return ['mail']; | ||
} | ||
|
||
public function toMail(): MailMessage | ||
{ | ||
return (new MailMessage) | ||
->subject('2FA ' . config('app.name')) | ||
->greeting(__('two_factor_auth::messages.email_hi')) | ||
->line(__('two_factor_auth::messages.email_text')) | ||
->action(__('two_factor_auth::messages.email_btn_action'), route('two_factor_auth.setup', ['token' => $this->token])); | ||
} | ||
|
||
public static function toMailUsing($callback): void | ||
{ | ||
static::$toMailCallback = $callback; | ||
} | ||
} |
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,10 @@ | ||
<?php | ||
|
||
return [ | ||
'error_email_not_sent' => 'An error ocurred when trying to send you an email. Please try again by reloading this page.', | ||
'error_msg' => 'Invalid code. Please try again.', | ||
'setup_email_sent' => 'We have sent you an email to setup your 2FA account.', | ||
'email_hi' => 'Hi!', | ||
'email_text' => 'You have requested to link another device to your 2FA protected account.', | ||
'email_btn_action' => 'Add device for 2FA', | ||
]; |
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,10 @@ | ||
<?php | ||
|
||
return [ | ||
'error_email_not_sent' => 'Ocurrió un error al enviarle un email. Por favor intente nuevamente regargando esta página.', | ||
'error_msg' => 'Código inválido. Por favor, inténtelo de nuevo.', | ||
'setup_email_sent' => 'Te enviamos un email para configurar tu 2FA.', | ||
'email_hi' => 'Hola!', | ||
'email_text' => 'Ha solicitado vincular un dispositivo a su cuenta protegida por 2FA.', | ||
'email_btn_action' => 'Add device for 2FA', | ||
]; |
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,35 @@ | ||
@extends(\Illuminate\Support\Facades\Config::get('two_factor_auth.layout')) | ||
|
||
<section class="bg-light" style="height: 100vh;"> | ||
<div class="container py-5 h-100"> | ||
<div class="row d-md-flex justify-content-center align-items-center h-100"> | ||
<div class="col-xl-10"> | ||
<div class="card rounded-3 bg-white"> | ||
<div class="row g-0"> | ||
<div class="card-body p-md-5 mx-md-4"> | ||
<div class="text-center"> | ||
<img src="{{ asset('vendor/two_factor_auth/shield.png') }}" alt="Shield" style="max-width: 100px; height: auto;"> | ||
<h4 class="mt-1 pb-1">{{ __('two_factor_auth::form.setup_title') }}</h4> | ||
</div> | ||
@if($emailSent) | ||
<div class="alert alert-success text-center"> | ||
<p class="mb-0">{{ __('two_factor_auth::messages.setup_email_sent') }}</p> | ||
</div> | ||
@else | ||
<div class="alert alert-danger text-center"> | ||
<p class="mb-0">{{ __('two_factor_auth::messages.error_email_not_sent') }}</p> | ||
</div> | ||
@endif | ||
@if(__('two_factor_auth::form.warning')) | ||
<hr> | ||
<div class="alert alert-warning text-center"> | ||
<small class="text-center">{{ __('two_factor_auth::form.warning') }}</small> | ||
</div> | ||
@endif | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> |
Oops, something went wrong.