File tree Expand file tree Collapse file tree 6 files changed +12
-24
lines changed Expand file tree Collapse file tree 6 files changed +12
-24
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- // translations for Stephenjude/FilamentTwoFactorAuthentication
4
3
return [
5
4
'confirm_two_factor_authentication ' => [
6
5
'wrong_code ' => 'The provided two factor authentication code was invalid. ' ,
Original file line number Diff line number Diff line change 3
3
return [
4
4
'subheading ' => 'Or ' ,
5
5
'challenge ' => [
6
- 'action_label ' => 'use a recovery code ' ,
6
+ 'action_label ' => 'Use a recovery code ' ,
7
7
'confirm ' => 'Please confirm access to your account by entering the authentication code provided by your authenticator application. ' ,
8
8
'code ' => 'Code ' ,
9
9
'error ' => 'The provided two factor authentication code was invalid. ' ,
10
10
],
11
11
'recovery ' => [
12
- 'action_label ' => 'use an authentication code ' ,
12
+ 'action_label ' => 'Use an authentication code ' ,
13
13
'form_hint ' => 'Please confirm access to your account by entering one of your emergency recovery codes. ' ,
14
14
'error ' => 'The provided two factor authentication code was invalid. ' ,
15
15
'title ' => 'Recovery Code ' ,
Original file line number Diff line number Diff line change 1
1
<div class =" flex justify-center w-full" >
2
2
<form method =" POST" action =" {{ filament ()-> getCurrentOrDefaultPanel ()-> getLogoutUrl () } }" >
3
3
@csrf
4
- <x-filament::link tag =" button" type =" submit" weight =" semibold" >
4
+ <x-filament::link style = " align-center " tag =" button" type =" submit" weight =" semibold" >
5
5
{{ __ (' filament-two-factor-authentication::components.logout.button' )} }
6
6
</x-filament::link >
7
7
</form >
Original file line number Diff line number Diff line change @@ -44,11 +44,7 @@ public function recoveryAction(): Action
44
44
return Action::make ('recovery ' )
45
45
->link ()
46
46
->label (__ ('filament-two-factor-authentication::pages.challenge.action_label ' ))
47
- ->url (
48
- filament ()->getCurrentOrDefaultPanel ()->route (
49
- 'two-factor.recovery '
50
- )
51
- );
47
+ ->url (filament ()->getCurrentOrDefaultPanel ()->route ('two-factor.recovery ' ));
52
48
}
53
49
54
50
public function authenticate ()
@@ -86,7 +82,6 @@ public function form(Schema $schema): Schema
86
82
->autocomplete ()
87
83
->rules ([
88
84
fn () => function (string $ attribute , $ value , $ fail ) {
89
-
90
85
$ user = Filament::auth ()->user ();
91
86
if (is_null ($ user )) {
92
87
$ fail (__ ('filament-two-factor-authentication::pages.challenge.error ' ));
@@ -122,7 +117,7 @@ public function getFormActions(): array
122
117
protected function getAuthenticateFormAction (): Action
123
118
{
124
119
return Action::make ('authenticate ' )
125
- ->label (__ ('filament-panels::pages/ auth/login.form.actions.authenticate.label ' ))
120
+ ->label (__ ('filament-panels::auth/pages /login.form.actions.authenticate.label ' ))
126
121
->submit ('authenticate ' );
127
122
}
128
123
Original file line number Diff line number Diff line change @@ -66,11 +66,7 @@ public function form(Schema $schema): Schema
66
66
->schema ([
67
67
TextInput::make ('recovery_code ' )
68
68
->hiddenLabel ()
69
- ->hint (
70
- __ (
71
- 'filament-two-factor-authentication::pages.recovery.form_hint '
72
- )
73
- )
69
+ ->hint (__ ('filament-two-factor-authentication::pages.recovery.form_hint ' ))
74
70
->required ()
75
71
->autocomplete ()
76
72
->autofocus ()
@@ -101,7 +97,7 @@ public function getFormActions(): array
101
97
protected function getAuthenticateFormAction (): Action
102
98
{
103
99
return Action::make ('authenticate ' )
104
- ->label (__ ('filament-panels::pages/ auth/login.form.actions.authenticate.label ' ))
100
+ ->label (__ ('filament-panels::auth/pages /login.form.actions.authenticate.label ' ))
105
101
->submit ('authenticate ' );
106
102
}
107
103
Original file line number Diff line number Diff line change 9
9
use BaconQrCode \Renderer \RendererStyle \RendererStyle ;
10
10
use BaconQrCode \Writer ;
11
11
use Illuminate \Support \Facades \Cache ;
12
- use Illuminate \Support \Facades \Hash ;
13
12
use Spatie \LaravelPasskeys \Models \Concerns \InteractsWithPasskeys ;
14
13
use Stephenjude \FilamentTwoFactorAuthentication \Events \RecoveryCodeReplaced ;
15
14
@@ -44,17 +43,16 @@ public function passkeyAuthenticated(): bool
44
43
45
44
public function isTwoFactorChallengePassed (): bool
46
45
{
47
- $ sessionKey = 'login_2fa_challenge_passed_ ' . $ this ->id ;
46
+ if ($ twoFactorSecretFromSession = session ()->get ("login:challenge:secret: $ this ->id " )) {
47
+ return decrypt ($ this ->two_factor_secret ) === decrypt ($ twoFactorSecretFromSession );
48
+ }
48
49
49
- return Hash:: check ( $ this -> two_factor_secret , session ()-> get ( $ sessionKey )) ;
50
+ return false ;
50
51
}
51
52
52
53
public function setTwoFactorChallengePassed (): void
53
54
{
54
- $ sessionKey = 'login_2fa_challenge_passed_ ' . $ this ->id ;
55
- $ sessionValue = Hash::make ($ this ->two_factor_secret );
56
-
57
- session ()->put ($ sessionKey , $ sessionValue );
55
+ session ()->put ("login:challenge:secret: $ this ->id " , $ this ->two_factor_secret );
58
56
}
59
57
60
58
/**
You can’t perform that action at this time.
0 commit comments