Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

decide where to go to after connecting with django-allauth

After connecting an account with a social app using django-allauth the user is redirected to accounts/social/connections. How can I change this behavior?

like image 867
user1680104 Avatar asked Nov 08 '12 18:11

user1680104


1 Answers

If the user is adding more social accounts to his existing (local) account, then the most logical default would be indeed to redirect to the social account connections management screen.

However, you can easily override the default by passing along a next parameter. Have a look here:

https://github.com/pennersr/django-allauth/blob/master/allauth/socialaccount/helpers.py#L125

You'll see that the next parameter is checked, falling back to the default (connections).

So, to change the default behavior, simply pass along a next parameter:

<a href="{% provider_login_url "openid" openid="https://www.google.com/accounts/o8/id" next="/success/url/" %}">Google</a>

If you are using the default templates you'll have to add next urls here:

https://github.com/pennersr/django-allauth/blob/master/allauth/templates/socialaccount/connections.html#L53

like image 129
pennersr Avatar answered Oct 30 '22 17:10

pennersr