I am using django-allauth , after signing up on site the user is sent to profile page but I want the user to go to the login page after signing up with a message "your account has been created"
Is there any way to do this?
You can first override get_login_redirect_url()
method from django-allauth
.
And then for sending message use django messages framework.
settings.py:
ACCOUNT_ADAPTER = 'yourapp.adapter.AccountAdapter' # ---> change it to your path
yourapp/adapter.py:
from allauth.account.adapter import DefaultAccountAdapter
from django.contrib import messages
class AccountAdapter(DefaultAccountAdapter):
def get_login_redirect_url(self, request):
messages.success(request, 'Your account created.')
return 'url/to/your/page' # --> change it to your page url
Answer update after comment:
To logout after account creation.
from django.contrib.auth import logout
logout(request) # --> put it before return above