How do I make allauth's authentication available on my homepage URL?

207 Views Asked by At

So i've installed Django allauth to handle my login authentication. However I don't want a seperate URL for login. I want it to be available on my homepage via Javascript onclick (login box appears when you click a button/no page refresh). But the current allauth URL is located at '/accounts/login'. So as I said I need it located at '/'. How would I do this?

Here is my views.py:

def boxes_view(request):

    ...

    search = request.GET.get('search')
    posts = Post.objects.all().filter(category=1).order_by('-date')
    if search:
        posts = posts.filter(
            Q(title__icontains=search) |
            Q(content__icontains=search)
        )
    else:
        posts = Post.objects.all().filter(category=1).order_by('-date')

    context = {
        'posts': posts,
    }

    return render(request, 'polls.html', context)

Can I pass it in as context or? How would it be done?

1

There are 1 best solutions below

3
On BEST ANSWER

It sounds like you want a user to be able to log in using a modal from your homepage, or what you currently see when going to '/'

If so, you don't change the allauth login url. Instead change your javascript code for your login box to present the contents given here.

See also this answer.