Skip to content

Commit 0357084

Browse files
committed
Support Fortify Options
1 parent de92b27 commit 0357084

File tree

12 files changed

+552
-202
lines changed

12 files changed

+552
-202
lines changed

app/Providers/FortifyServiceProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
use Illuminate\Http\Request;
77
use Illuminate\Support\Facades\RateLimiter;
88
use Illuminate\Support\ServiceProvider;
9-
use Illuminate\Support\Str;
109
use Laravel\Fortify\Fortify;
10+
use Livewire\Volt\Volt;
1111

1212
class FortifyServiceProvider extends ServiceProvider
1313
{
@@ -24,6 +24,7 @@ public function register(): void
2424
*/
2525
public function boot(): void
2626
{
27+
Fortify::ignoreRoutes();
2728
Fortify::twoFactorChallengeView(fn () => view('livewire.auth.two-factor-challenge'));
2829

2930
RateLimiter::for('two-factor', function (Request $request) {

config/fortify.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
|
7474
*/
7575

76-
'home' => '/dashbaord',
76+
'home' => '/dashboard',
7777

7878
/*
7979
|--------------------------------------------------------------------------
@@ -146,7 +146,7 @@
146146
'features' => [
147147
// Features::registration(),
148148
// Features::resetPasswords(),
149-
// // Features::emailVerification(),
149+
// Features::emailVerification(),
150150
// Features::updateProfileInformation(),
151151
// Features::updatePasswords(),
152152
Features::twoFactorAuthentication([
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{{-- Credit: Lucide (https://lucide.dev) --}}
2+
3+
@props([
4+
'variant' => 'outline',
5+
])
6+
7+
@php
8+
if ($variant === 'solid') {
9+
throw new \Exception('The "solid" variant is not supported in Lucide.');
10+
}
11+
12+
$classes = Flux::classes('shrink-0')
13+
->add(match($variant) {
14+
'outline' => '[:where(&)]:size-6',
15+
'solid' => '[:where(&)]:size-6',
16+
'mini' => '[:where(&)]:size-5',
17+
'micro' => '[:where(&)]:size-4',
18+
});
19+
20+
$strokeWidth = match ($variant) {
21+
'outline' => 2,
22+
'mini' => 2.25,
23+
'micro' => 2.5,
24+
};
25+
@endphp
26+
27+
<svg
28+
{{ $attributes->class($classes) }}
29+
data-flux-icon
30+
xmlns="http://www.w3.org/2000/svg"
31+
viewBox="0 0 24 24"
32+
fill="none"
33+
stroke="currentColor"
34+
stroke-width="{{ $strokeWidth }}"
35+
stroke-linecap="round"
36+
stroke-linejoin="round"
37+
aria-hidden="true"
38+
data-slot="icon"
39+
>
40+
<path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" />
41+
<circle cx="12" cy="12" r="3" />
42+
</svg>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{{-- Credit: Lucide (https://lucide.dev) --}}
2+
3+
@props([
4+
'variant' => 'outline',
5+
])
6+
7+
@php
8+
if ($variant === 'solid') {
9+
throw new \Exception('The "solid" variant is not supported in Lucide.');
10+
}
11+
12+
$classes = Flux::classes('shrink-0')
13+
->add(match($variant) {
14+
'outline' => '[:where(&)]:size-6',
15+
'solid' => '[:where(&)]:size-6',
16+
'mini' => '[:where(&)]:size-5',
17+
'micro' => '[:where(&)]:size-4',
18+
});
19+
20+
$strokeWidth = match ($variant) {
21+
'outline' => 2,
22+
'mini' => 2.25,
23+
'micro' => 2.5,
24+
};
25+
@endphp
26+
27+
<svg
28+
{{ $attributes->class($classes) }}
29+
data-flux-icon
30+
xmlns="http://www.w3.org/2000/svg"
31+
viewBox="0 0 24 24"
32+
fill="none"
33+
stroke="currentColor"
34+
stroke-width="{{ $strokeWidth }}"
35+
stroke-linecap="round"
36+
stroke-linejoin="round"
37+
aria-hidden="true"
38+
data-slot="icon"
39+
>
40+
<circle cx="12" cy="16" r="1" />
41+
<rect x="3" y="10" width="18" height="12" rx="2" />
42+
<path d="M7 10V7a5 5 0 0 1 10 0v3" />
43+
</svg>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{{-- Credit: Lucide (https://lucide.dev) --}}
2+
3+
@props([
4+
'variant' => 'outline',
5+
])
6+
7+
@php
8+
if ($variant === 'solid') {
9+
throw new \Exception('The "solid" variant is not supported in Lucide.');
10+
}
11+
12+
$classes = Flux::classes('shrink-0')
13+
->add(match($variant) {
14+
'outline' => '[:where(&)]:size-6',
15+
'solid' => '[:where(&)]:size-6',
16+
'mini' => '[:where(&)]:size-5',
17+
'micro' => '[:where(&)]:size-4',
18+
});
19+
20+
$strokeWidth = match ($variant) {
21+
'outline' => 2,
22+
'mini' => 2.25,
23+
'micro' => 2.5,
24+
};
25+
@endphp
26+
27+
<svg
28+
{{ $attributes->class($classes) }}
29+
data-flux-icon
30+
xmlns="http://www.w3.org/2000/svg"
31+
viewBox="0 0 24 24"
32+
fill="none"
33+
stroke="currentColor"
34+
stroke-width="{{ $strokeWidth }}"
35+
stroke-linecap="round"
36+
stroke-linejoin="round"
37+
aria-hidden="true"
38+
data-slot="icon"
39+
>
40+
<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" />
41+
<path d="M21 3v5h-5" />
42+
<path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" />
43+
<path d="M8 16H3v5" />
44+
</svg>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{{-- Credit: Lucide (https://lucide.dev) --}}
2+
3+
@props([
4+
'variant' => 'outline',
5+
])
6+
7+
@php
8+
if ($variant === 'solid') {
9+
throw new \Exception('The "solid" variant is not supported in Lucide.');
10+
}
11+
12+
$classes = Flux::classes('shrink-0')
13+
->add(match($variant) {
14+
'outline' => '[:where(&)]:size-6',
15+
'solid' => '[:where(&)]:size-6',
16+
'mini' => '[:where(&)]:size-5',
17+
'micro' => '[:where(&)]:size-4',
18+
});
19+
20+
$strokeWidth = match ($variant) {
21+
'outline' => 2,
22+
'mini' => 2.25,
23+
'micro' => 2.5,
24+
};
25+
@endphp
26+
27+
<svg
28+
{{ $attributes->class($classes) }}
29+
data-flux-icon
30+
xmlns="http://www.w3.org/2000/svg"
31+
viewBox="0 0 24 24"
32+
fill="none"
33+
stroke="currentColor"
34+
stroke-width="{{ $strokeWidth }}"
35+
stroke-linecap="round"
36+
stroke-linejoin="round"
37+
aria-hidden="true"
38+
data-slot="icon"
39+
>
40+
<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" />
41+
<path d="m4.243 5.21 14.39 12.472" />
42+
</svg>

resources/views/livewire/auth/confirm-password.blade.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22
3+
use Illuminate\Validation\ValidationException;
34
use Livewire\Attributes\Layout;
45
use Livewire\Volt\Component;
56
use Laravel\Fortify\Actions\ConfirmPassword;
@@ -16,7 +17,7 @@ public function confirmPassword(): void
1617
'password' => ['required', 'string'],
1718
]);
1819
19-
if (! Auth::guard('web')->validate([
20+
if (!Auth::guard('web')->validate([
2021
'email' => Auth::user()->email,
2122
'password' => $this->password,
2223
])) {
@@ -30,15 +31,14 @@ public function confirmPassword(): void
3031
$this->redirectIntended(default: route('dashboard', absolute: false), navigate: true);
3132
}
3233
}; ?>
33-
3434
<div class="flex flex-col gap-6">
3535
<x-auth-header
3636
:title="__('Confirm password')"
3737
:description="__('This is a secure area of the application. Please confirm your password before continuing.')"
3838
/>
3939

4040
<!-- Session Status -->
41-
<x-auth-session-status class="text-center" :status="session('status')" />
41+
<x-auth-session-status class="text-center" :status="session('status')"/>
4242

4343
<form method="POST" wire:submit="confirmPassword" class="flex flex-col gap-6">
4444
<!-- Password -->

resources/views/livewire/auth/two-factor-challenge.blade.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
showRecoveryInput: {{ $errors->has('recovery_code') ? 'true' : 'false' }},
55
code: '',
66
recovery_code: ''
7-
}" class="relative w-full h-auto">
7+
}" class="relative w-full h-auto" >
88
<div x-show="!showRecoveryInput">
99
<x-auth-header :title="__('Authentication Code')" :description="__('Enter the authentication code provided by your authenticator application.')" />
1010
</div>
1111
<div x-show="showRecoveryInput">
1212
<x-auth-header :title="__('Recovery Code')" :description="__('Please confirm access to your account by entering one of your emergency recovery codes.')" />
1313
</div>
1414

15-
<form method="POST" action="{{ route('two-factor.login.store') }}">
15+
<form method="POST" action="{{ route('two-factor.login.store') }}" x-cloak>
1616
@csrf
1717

1818
<div class="space-y-5 text-center">
@@ -25,7 +25,7 @@
2525
<p class="my-2 text-sm text-red-600">{{ $message }}</p>
2626
@enderror
2727
</div>
28-
<div x-show="showRecoveryInput" x-cloak>
28+
<div x-show="showRecoveryInput">
2929
<div class="my-5">
3030
<flux:input type="text" name="recovery_code" x-ref="recovery_code"
3131
x-bind:required="showRecoveryInput" autocomplete="one-time-code"
@@ -43,14 +43,12 @@
4343
</div>
4444

4545
<div class="mt-5 space-x-0.5 text-sm leading-5 text-center">
46-
<span class="opacity-50">or you can </span>
46+
<span class="opacity-50">{{ __('or you can') }} </span>
4747
<div class="font-medium underline opacity-80 cursor-pointer inline">
4848
<span x-show="!showRecoveryInput"
49-
@click="showRecoveryInput = true; code = ''; recovery_code = ''; $dispatch('clear-auth-2fa-auth-code'); $nextTick(() => $refs.recovery_code?.focus())">login
50-
using a recovery code</span>
49+
@click="showRecoveryInput = true; code = ''; recovery_code = ''; $dispatch('clear-auth-2fa-auth-code'); $nextTick(() => $refs.recovery_code?.focus())">{{ __('login using a recovery code') }}</span>
5150
<span x-show="showRecoveryInput" x-cloak
52-
@click="showRecoveryInput = false; code = ''; recovery_code = ''; $dispatch('clear-auth-2fa-auth-code'); $nextTick(() => $dispatch('focus-auth-2fa-auth-code'))">login
53-
using an authentication code</span>
51+
@click="showRecoveryInput = false; code = ''; recovery_code = ''; $dispatch('clear-auth-2fa-auth-code'); $nextTick(() => $dispatch('focus-auth-2fa-auth-code'))">{{ __('login using an authentication code') }}</span>
5452
</div>
5553
</div>
5654
</form>

0 commit comments

Comments
 (0)