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.
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
toTrue
in thepost_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 theLitestarUsersConfig
class. This boolean attribute, which defaults toTrue
, can be set toFalse
to explicitly disable verification.The main changes are in the
register
method of theBaseUserService
class, where it is checked whether verification is required before initiating the verification flow. If verification is not required, the new user is created withis_verified
set toTrue
. I've also added a new test to check that the verification process can be correctly disabled, and I've updated the docs accordingly.