-
Notifications
You must be signed in to change notification settings - Fork 356
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
WIP: Use the user model as the email model. #353
base: master
Are you sure you want to change the base?
Conversation
You can customize the user model so that the email is the username, in cases like that it may be superflouous to have multiple emails, in fact it may not be desirable. For applications like that it's easier to only use the email address defined in the user model.
4db2242
to
6736b71
Compare
@@ -334,9 +330,11 @@ def send(self, **kwargs): | |||
current_site.domain, | |||
reverse(settings.ACCOUNT_EMAIL_CONFIRMATION_URL, args=[self.key]) | |||
) | |||
|
|||
user = self.email_address.user if not user_as_email() else self |
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.
user = self.email_address.user if not user_as_email() else self | |
user = self.email_address.user if not user_as_email() else self.email_address |
|
||
class EmailAddressManager(models.Manager): | ||
|
||
def add_email(self, user, email, **kwargs): | ||
confirm = kwargs.pop("confirm", False) | ||
email_address = self.create(user=user, email=email, **kwargs) | ||
if confirm and not email_address.verified: | ||
email_address.send_confirmation() | ||
self.send_confirmation(email=email) |
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.
self.send_confirmation(email=email) | |
self.send_confirmation(email=email_address) |
Not quite following this one but it is a pretty big change in how we consider email addresses with |
You can customize the user model so that the email
is the username, in cases like that it may be superflouous
to have multiple emails, in fact it may not be desirable.
For applications like that it's easier to only use the email
address defined in the user model.
Closes #347.