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
Dash to underscore replacing leads to duplicate entries in social_auth_by_name_backends #751
Comments
Even a simple workaround like this would not work if user has not associated account with a dash in backend name. The list will not include the backend with a dash because it is replaced only for associated accounts. <h3>Connect more accounts (to be able to log in with any of them)</h3>
<ul>
{% for backend, user_sa in social_auth.items %}
{% if not user_sa and not '-' in backend %}
<li><a href="{% url 'socialauth_begin' backend %}">{{ backend }}</a></li>
{% endif %}
{% endfor %}
</ul> |
@mikek, I've pushed a fix for this issue, now all backends have |
While we can get disconnect URLs regardless of the backend 'key':
'socialauth_begin' URLs for backends with dashes are broken now:
will produce 'underscored' URLs. Any other way to iterate over all enabled backends to connect and disconnect accounts? |
@mikek, my bad, I've removed the dash replacement with underscore, the dict won't be accessible using dot notation, but seems that nobody is using it like that or an issue would be raised already. |
Thanks, this simple approach should add no controversy! |
The
context_processors.social_auth_by_name_backends
adds a new item with dash replaced by undersocre for the backends which the authenticated user has associated with his account.So after authenticating the
social_auth.items|pprint
in template reveals duplicate entries like:[(u'google_oauth2', <UserSocialAuth: bot44cafe - Google-Oauth2>), ('google-oauth2', None), ('facebook', None)]
.This makes hard to iterate over them constructing URLs with backend names, etc. Is this replacement a must-have? Could we at least make it consistent by removing items (with
None
values) replaced in this process? (This does not solve constructing urls though.)The text was updated successfully, but these errors were encountered: