Skip to content

Commit

Permalink
Resend notification action for email and SMS
Browse files Browse the repository at this point in the history
  • Loading branch information
Baspa committed Aug 17, 2024
1 parent 246cc06 commit 4152fd0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
6 changes: 3 additions & 3 deletions resources/views/auth/login-two-factor.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
{{ $this->registerAction }}
</x-slot>
@endif
<h2 class="mt-10 text-lg font-semibold text-gray-900 text-center">
<h2 class="mt-5 text-lg font-semibold text-gray-900 text-center">
{{ __('Authenticate with your code') }}
</h2>

{{ $this->resend }}
<form method="POST" action="{{ route('two-factor.login') }}" class="space-y-8">

@csrf
{{ $this->form }}

<div class="flex items-center justify-between mt-6">
<x-filament::button type="submit" class="w-full" color="info">
<x-filament::button type="submit" class="w-full">
{{ __('Login') }}
</x-filament::button>
</div>
Expand Down
19 changes: 10 additions & 9 deletions src/Http/Livewire/Auth/LoginTwoFactor.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
namespace Vormkracht10\TwoFactorAuth\Http\Livewire\Auth;

use App\Models\User;
use App\Notifications\SendOTP;
use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;
use DanHarrin\LivewireRateLimiting\WithRateLimiting;
use Filament\Pages\Page;
use Filament\Actions\Action;
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Components\TextInput;
use Filament\Notifications\Notification;
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Concerns\InteractsWithForms;
use DanHarrin\LivewireRateLimiting\WithRateLimiting;
use Filament\Pages\Concerns\InteractsWithFormActions;
use Filament\Pages\Page;
use Vormkracht10\TwoFactorAuth\Notifications\SendOTP;
use Laravel\Fortify\Http\Requests\TwoFactorLoginRequest;
use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;

class LoginTwoFactor extends Page implements HasActions, HasForms
{
Expand All @@ -26,6 +26,8 @@ class LoginTwoFactor extends Page implements HasActions, HasForms

protected static string $view = 'filament-two-factor-auth::auth.login-two-factor';

protected static bool $shouldRegisterNavigation = false;

public ?User $challengedUser = null;

Check failure on line 31 in src/Http/Livewire/Auth/LoginTwoFactor.php

View workflow job for this annotation

GitHub Actions / phpstan

Property Vormkracht10\TwoFactorAuth\Http\Livewire\Auth\LoginTwoFactor::$challengedUser has unknown class App\Models\User as its type.

Check failure on line 31 in src/Http/Livewire/Auth/LoginTwoFactor.php

View workflow job for this annotation

GitHub Actions / phpstan

Property Vormkracht10\TwoFactorAuth\Http\Livewire\Auth\LoginTwoFactor::$challengedUser has unknown class App\Models\User as its type.

public function mount(TwoFactorLoginRequest $request): void
Expand All @@ -40,11 +42,10 @@ public function hasLogo(): bool
return false;
}

public function resend(): ?Action
public function resend(): Action
{
return Action::make('resend')
->label(__('Resend'))
->color('info')
->extraAttributes(['class' => 'w-full text-xs'])
->link()
->action(function () {
Expand Down
2 changes: 2 additions & 0 deletions src/TwoFactorAuthPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Filament\Navigation\MenuItem;
use Filament\Panel;
use Vormkracht10\TwoFactorAuth\Http\Livewire\Auth\Login;
use Vormkracht10\TwoFactorAuth\Http\Livewire\Auth\LoginTwoFactor;
use Vormkracht10\TwoFactorAuth\Pages\TwoFactor;

class TwoFactorAuthPlugin implements Plugin
Expand All @@ -27,6 +28,7 @@ public function register(Panel $panel): void
])
->pages([
TwoFactor::class,
LoginTwoFactor::class,
])
->viteTheme('vendor/vormkracht10/filament-two-factor-auth/resources/dist/filament-two-factor-auth.css');
}
Expand Down

0 comments on commit 4152fd0

Please sign in to comment.