Session not identified in some logins in django

0

I'm doing a maintenance on a Django app version 1.5 with DRF 2.3. This app has non-standard Django user authentication, and that works well. See a summary below:

accounts / views.py

class Autentica(TemplateView):
template_name = 'checkuser.html'

def get(self, request, *args, **kwargs):
    self.request.session['token'] = request.GET['token']
    self.request.session['idUser'] = request.GET['idUser']
    #resto do código ...

But when I try to access these two session variables (idUser and token) through another endpoint of the same system (IN SOME CASES) the values of "idUser" and "token" do not exist, as if they had not been defined in the authentication, I did the same process and checked the authentication method and both values are being set normally.

Here is the endpoint I'm trying to access

core / views.py

class PainelGestaoUsuariosView(LoginRequiredMixin, View):
def get(self, request):
    # OUTROS TRATAMENTOS....  
    idUser = self.request.session['idUser']
    token  = self.request.session['token']
    #ou request.session['...'] 
    return HttpResponseRedirect('%URLPARAOSISTEMATERCEIRO/check?token=%s&idUser=%s'%(token,idUser))

Note:

  • I've enabled 'django.contrib.sessions' and 'django.contrib.sessions.middleware.SessionMiddleware' in settings.py

  • Almost all logins work (I can access session variables), except for 3 logins that I did not find any difference.

  • li>

asked by anonymous 30.08.2017 / 18:53

1 answer

0

Well, at the end of the day due to fatigue I did not notice an exdrúxulo detail but not less important, that is the URL to which you do a redirect, whose which was in ALLOWED_HOSTS without the www. Item Resolved!

    
30.08.2017 / 22:15