Skip to content

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

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Conversation

gkijko
Copy link

@gkijko gkijko commented Aug 13, 2019

No description provided.

merwok and others added 11 commits February 27, 2019 22:28
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.
@gkijko gkijko requested a review from merwok August 13, 2019 16:56
@@ -51,12 +51,15 @@ def post(self, request):
user = deserializer.save()

if self.email_confirmation_class is None:
Copy link
Author

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.

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem is known #38 and has a PR #44


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()
Copy link
Contributor

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.

@merwok merwok changed the base branch from develop to master December 3, 2020 03:00
@merwok merwok changed the base branch from master to main December 8, 2020 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants