phpsa / filament-authentication

MIT License
105 stars 23 forks source link

Avoid registering middlewares and routes if feature is disabled and add opt-out #54

Open xDefcon opened 1 month ago

xDefcon commented 1 month ago

If a specific feature is disabled from the config file, there's no reason to load specific middlewares and routes.

I am referring to:

  1. ImpersonatingMiddleware
  2. RenewPasswordMiddleware

https://github.com/phpsa/filament-authentication/blob/d32ce3624a90532c8b4a0407766a62ba6f4afded/src/FilamentAuthentication.php#L58

And for the routes:

https://github.com/phpsa/filament-authentication/blob/d32ce3624a90532c8b4a0407766a62ba6f4afded/routes/web.php#L8

It would be also cool to have the option to disable from the config file the password_renewal feature. If disabled, the specific route and middleware should not be loaded in the application.

Would you accept a PR having those modifications? Do you see any issues in implementing those features?

Thank you 👍

phpsa commented 1 month ago

PRs sre always welcome as are requests / bug reports, so thanks.

If you csn put in a pul request i will look at it, else will look at it myself in a few days,

phpsa commented 1 month ago

@xDefcon -- initial work on this: https://github.com/phpsa/filament-authentication/releases/tag/v4.3.0-beta.1