LonelyVikingMichael / litestar-users

Authentication and user management for the Litestar framework
https://lonelyvikingmichael.github.io/litestar-users/
MIT License
47 stars 12 forks source link

feat: config attribute to enable/disable the verification process #73

Closed davidelofrese closed 3 months ago

davidelofrese commented 3 months ago

This PR adds a new config attribute to enable/disable the verification process.

Currently, verification of new users can be skipped by setting user.is_verified to True in the post_registration_hook method, but I feel that this approach is a bit cumbersome. To streamline the process of enabling/disabling user verification, I've added a new configuration attribute (require_verification_on_registration) to the LitestarUsersConfig class. This boolean attribute, which defaults to True, can be set to False to explicitly disable verification.

The main changes are in the register method of the BaseUserService class, where it is checked whether verification is required before initiating the verification flow. If verification is not required, the new user is created with is_verified set to True. I've also added a new test to check that the verification process can be correctly disabled, and I've updated the docs accordingly.

LonelyVikingMichael commented 3 months ago

Thanks for this, will you please rebase and push again?

I've fixed some type checking issues on the main branch.

davidelofrese commented 3 months ago

Done!