omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

Support namespace via : #971

Closed LennyLip closed 8 years ago

LennyLip commented 8 years ago

When we use django url namespace and use url split via : like a

SOCIAL_AUTH_LOGIN_ERROR_URL = 'social:error'

for example, next code is wrong (may be and in other places) https://github.com/omab/python-social-auth/blob/b07708efe7d19b75009771aa97ddf821e59ec08e/social/apps/django_app/middleware.py#L42

url += ('?' in url and '&' or '?') + \
                       'message={0}&backend={1}'.format(urlquote(message),
                                                        backend_name)

we must reverse before url contacting

url = reverse(self.get_redirect_uri(request, exception))
url += ('?' in url and '&' or '?') + \
                       'message={0}&backend={1}'.format(urlquote(message),
                                                        backend_name)
webjunkie commented 8 years ago

Might be a duplicate of my pull request and also be fixed by that: #905

LennyLip commented 8 years ago

@webjunkie Yeah, seems it is duplicate.