2

I have successfully installed pybb app and all is good except the fact that I don't how to 'tell' pybb app that a user has been authenticated by my main app. I'm using function based views and the normal authenticate -> login routine as described in the django documentation. My authentication function looks like this:

def index_view(request):
    if request.method == 'POST':
        form = LoginForm(request.POST)
        if form.is_valid():
            user_name = form.cleaned_data['username']
            password = form.cleaned_data['password']
            person = authenticate(username=user_name, password=password)
            if person is not None:
                login(request, person)
                if request.user.is_authenticated:                    
                    return HttpResponseRedirect("/forum")
    form = LoginForm()
    return render(request, 'index.html', {'loginform': form})

And my main urls.py has this included as per directed in the pybb documentation

url(r'^forum/', include('pybb.urls', namespace='pybb'))

I can verify that a user has been authenticated before I do the HttpResponseRedirect("/forum") but that seems to get lost once the pybb app is loaded . I just don't know where I should start looking into. Any help is greatly appreciated.
Thanks

M.javid
  • 6,387
  • 3
  • 41
  • 56
michaelmwangi
  • 284
  • 1
  • 2
  • 13

0 Answers0