-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Attempt to read property "value" on null error #47
Comments
Did you follow all the installation steps from the readme? @enessvg |
@Baspa Yes |
Can you provide me a reproduction repository? Then I'll be happy to help @enessvg |
I can't provide it right now, but I can leave photos like this: Deleted value code: @Baspa Maybe it's my fault, I'll install it in another project and try again. But as I said, I did the installation completely by following https://filamentphp.com/plugins/vormkracht10-2fa |
Did you run migrations? Can you show me your user model and did you setup 2FA for the user? @enessvg |
Yes, I've run migrations. @Baspa User.php: use Laravel\Fortify\TwoFactorAuthenticatable;
use Vormkracht10\TwoFactorAuth\Enums\TwoFactorType;
use HasFactory, Notifiable, HasRoles, HasPanelShield, TwoFactorAuthenticatable;
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'two_factor_type' => TwoFactorType::class,
];
} |
I just did a fresh installation here and got no errors: https://github.com/Baspa/reproduction-repo you can check my latest commit @enessvg |
Okey, I will try to reinstall and try again, thanks.
|
Any updates on this issue? @enessvg |
@Baspa Sorry for not replying, I still haven't tried it, I will try it as soon as possible and write here |
I looked at using this package and got the same error, it would appear the casting doesn't cast null/empty two_factor_types. Ideally there should be either a default, or login if 2fa type is not set. |
Thanks for checking both, will try to look for a fix later today @enessvg / @tonypartridge |
Did you guys install this package after already using Laravel Fortify? I guess this issue might happen when the user already has set the 2FA on their user but didn't use this package yet. Then the 2FA might be "enabled", which causes the user to be redirected to the 2FA login page, but there is no 2FA type set. If that's the case I might need to change the documentation. |
Yep! Using jetsream
Many thanks
Tony
…On Wed, 2 Oct 2024 at 10:15, Bas van Dinther ***@***.***> wrote:
Did you guys install this package *after* already using Laravel Fortify?
I guess this issue might happen when the user already has set the 2FA on
their user but didn't use this package yet. Then the 2FA might be
"enabled", which causes the user to be redirected to the 2FA login page,
but there is no 2FA type set.
If that's the case I might need to change the documentation.
@enessvg <https://github.com/enessvg> / @tonypartridge
<https://github.com/tonypartridge>
—
Reply to this email directly, view it on GitHub
<#47 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAKWBFS7ABHW6OE3HLVOFK3ZZO2S7AVCNFSM6AAAAABPBS6SUGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOBYGAYDCMJTGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
https://filamentphp.com/plugins/vormkracht10-2fa#installation |
@enessvg / @tonypartridge after I merge #49 in a few minutes you should update the package and re-run Remove previous migration from this package before running the install command. When you run the migrations through the install command again it will now prompt if you want to update existing users to set their missing |
@Baspa Thank you, I'm glad I wrote this error here |
Good stuff, will review. |
only thoughts are: Would you like us to set the two factor type to "authenticator" for existing users? (yes/no) should be Would you like us to set the two factor type to "authenticator" for users that previously used 2FA in fortify? (yes/no) |
I tried this and disabled normal 2fa and then tried email but never got the email even with queue working. |
Feel free to submit a PR! @tonypartridge |
What are the exact steps you did? Have you set a |
What happened?
hello, I installed the plugin and opened 2fa, then when I tried to log in, I got an error like this:
Attempt to read property “value” on null
In order to resolve this error
vendor\vormkracht10\filament-2fa\src\Http\Livewire\Auth\LoginTwoFactor.php
In line 44 $this->twoFactorType = $this->challengedUser->two_factor_type->value;
It worked when I removed the value from the code, what is this caused by? can you check?
Translated with DeepL.com (free version)
How to reproduce the bug
Bu hatayı çözmek içinde
vendor\vormkracht10\filament-2fa\src\Http\Livewire\Auth\LoginTwoFactor.php
44. satırdaki $this->twoFactorType = $this->challengedUser->two_factor_type->value;
kodundan valueyi kaldırınca çalıştı bu neyden kaynaklanıyor? kontrol edermisiniz?
Package Version
1.6^
PHP Version
8.2.4
Laravel Version
11.0.0
Which operating systems does with happen with?
Windows
Notes
No response
The text was updated successfully, but these errors were encountered: