问题描述
使用django-allauth连接到社交应用的帐户后,用户被重定向到 accounts / social / connections
。如何更改此行为?
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?
推荐答案
如果用户在现有(本地)帐户中添加了更多的社交帐户,那么最合乎逻辑的默认将确实是重定向到社交帐户连接管理屏幕。
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:
您会看到下一个
参数已被检查,退回到默认(连接)。
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:
这篇关于决定与django-allauth连接后去哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!