vormkracht10 / filament-2fa

Integrate Laravel Fortify easily in your Filament apps.
MIT License
44 stars 3 forks source link

Is it possible to force optional #51

Open akiftezcan38 opened 1 month ago

akiftezcan38 commented 1 month ago

What happened?

Hello.

forced() function forces 2FA for the whole system

but

I want to force 2fa for some users. but I don't want to force it for some users. is there a way I can do this?

Can you help me

How to reproduce the bug

that's it

Repository

filament-2fa

Package Version

1.6

PHP Version

8.2

Laravel Version

11

Which operating systems does with happen with?

Linux

Notes

No response

Baspa commented 1 month ago

Unfortunately that's not possible. You should create your own middleware to implement such logic. You could take a look at the middleware in the package for some inspiration. @akiftezcan38

akiftezcan38 commented 1 month ago

Unfortunately that's not possible. You should create your own middleware to implement such logic. You could take a look at the middleware in the package for some inspiration. @akiftezcan38

@Baspa Thanks

I think you should add this feature. Because this is a feature that everyone needs.

Baspa commented 1 month ago

I might be able to add it in the future, but in the upcoming weeks I don't have any time (due holiday). If you want you could try to change the ForceTwoFactor middleware and submit a PR :) @akiftezcan38

akiftezcan38 commented 1 month ago

I might be able to add it in the future, but in the upcoming weeks I don't have any time (due holiday). If you want you could try to change the ForceTwoFactor middleware and submit a PR :) @akiftezcan38

image

Actually what you do is very simple.

Just add a condition in the RedirectIfTwoFactorAuthenticatable middleware. Also a column in the users table and that's it.

I am not very familiar with the contents of the package, so I avoid opening a Merge request. @Baspa