Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue warnings for deprecated settings. Refs gh-90
- Loading branch information
Showing
4 changed files
with
30 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,15 @@ | |
from django.core.exceptions import MultipleObjectsReturned | ||
|
||
from social_auth.models import User | ||
from social_auth.backends.pipeline import warn_setting | ||
|
||
|
||
def associate_by_email(details, *args, **kwargs): | ||
"""Return user entry with same email address as one returned on details.""" | ||
email = details.get('email') | ||
|
||
warn_setting('SOCIAL_AUTH_ASSOCIATE_BY_MAIL', 'associate_by_email') | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
omab
Author
Owner
|
||
|
||
if email and getattr(settings, 'SOCIAL_AUTH_ASSOCIATE_BY_MAIL', False): | ||
# try to associate accounts registered with the same email address, | ||
# only if it's a single object. ValueError is raised if multiple | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This isn't quite right. since the getattr() call on line 14 defaults to False, this pipeline component doesn't function without the SOCIAL_AUTH_ASSOCIATE_BY_MAIL setting set. This means that applications cannot use this component's functionality without getting the deprecation warnings. Changing the default value in the getattr() call is probably not a good idea because it would change the behavior for existing applications, so maybe just remove the deprecation warning?