-
Notifications
You must be signed in to change notification settings - Fork 1
Fix/allow_registration_without_email_confirmation #103
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
base: main
Are you sure you want to change the base?
Conversation
Post-release merge
Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Currently if the setting REST_AUTH_TOOLKIT['email_confirmation_send_email'] is set to false, the registration view still requires an email_confirmation_class and it also skips the confirmation email (that is correct) but it does not set the user as active. This first change enables the automatic activation of users if the email_confirmation_send_email settings is set to false.
@@ -51,12 +51,15 @@ def post(self, request): | |||
user = deserializer.save() | |||
|
|||
if self.email_confirmation_class is None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think line 53 to 56 should go after the if get_setting('email_confirmation_send_email', True):
That way there would be no need to define the email_confirmation_class if the email_confirmation_send_email is set to False.
Other option would be to let is as is and let the programer decide how he wants to validate the emails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea was that you always want a record in your DB (using your email confirmation class), but not always want to send actual email messages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
||
confirmation = self.email_confirmation_class.objects.create(user=user) | ||
if get_setting('email_confirmation_send_email', True): | ||
email_field = user.get_email_field_name() | ||
send_email(request, user, getattr(user, email_field), confirmation) | ||
else: | ||
user.is_active = True | ||
user.save() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This wouldn’t be right for this class, but see the RestAuthToolkitMinimal app config class that doesn’t do user activation.
No description provided.