I would like to redirect to a certain link after social signup, how and where do I do that? I can do it for regular signup but I can't for social signup.
Alternatively you can write your own custom social account adapter to handle different logged in redirection from different social accounts and not messing with your normal account settings, like so:
# adapter.py
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
class SocialAccountAdapter(DefaultSocialAccountAdapter):
def get_login_redirect_url(self, request):
# do your logic here for different social accounts
...
return 'url/to/your/redirection' # or reverse(view) or whatever
# settings.py
SOCIALACCOUNT_ADAPTER = "point.to.adaptor.SocialAccountAdapter"
In case you want to alter the redirection for newly signed up, you may customise adapter's save_user method:
class SocialAccountAdapter(DefaultSocialAccountAdapter):
...
def save_user(self, request, sociallogin, form=None):
super(DefaultSocialAccountAdapter, self).save_user(request, sociallogin, form=form)
# your logic here... and return redirection afterward
return redirect(...)
After both social and normal it should be redirecting to your LOGIN_REDIRECT_URL
in settings. Do you have that set?
Theres also some good information here about custom redirection
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With