0
I am doing a maintenance on a Django app version 1.5 with DRF 2.3. This app features off-the-shelf user authentication 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 in the authentication method and both values are being set normally.
Here’s 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))
Obs.:
I enabled 'Django.contrib.Sessions' and 'Django.contrib.Sessions.middleware.Sessionmiddleware' in Settings.py
Almost all logins work (I can access session variables), except 3 logins I couldn’t find a difference.
How authentication is done differently from Django’s default request user. is the same as "Anonymous User" but I believe it has not influenced this.