Giter Club home page Giter Club logo

Comments (5)

last-partizan avatar last-partizan commented on June 1, 2024

If user accessing site without session key, new session is created.

I don't understand what the problem is.
Can you provide steps to reproduce?

from django-mongoengine.

waynetian avatar waynetian commented on June 1, 2024

OK, I find the issue in my two website projects. I use django-mongoengine as my session engine.

You can reproduce as the follows:

  1. First (The most important!!!), confirm you access the site without session key.
  2. Second. you can login your website with your name and password.
    The server side code is like this. It is easy to use django_maongoengine as session engine. If the session engine is correct, the session data will be save in the mongodb, but unlukily it is not. the account_id and username is missing.

I have traced the code,

I reproduce the above steps, then the console will output as follows. You can see it has saved the session_data twice, and the last one is incorrect.

------------------ 原始邮件 ------------------
发件人: "last-partizan";[email protected];
发送时间: 2016年5月11日(星期三) 晚上7:06
收件人: "MongoEngine/django-mongoengine"[email protected];
抄送: "WAYNE"[email protected]; "Author"[email protected];
主题: Re: [MongoEngine/django-mongoengine] Session Issue (#59)

If user accessing site without session key, new session is created.

I don't understand what the problem is.
Can you provide steps to reproduce?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub

from django-mongoengine.

last-partizan avatar last-partizan commented on June 1, 2024

I tried to reproduce your bug; Session indeed saved twice after login, but that is expected behavior; Django first created new session and then saves data after login.

2016-05-11 15-28-54

This is tested with our example/tumblelog app and login to django-admin.

account_id or username is not used by auth system, it uses _auth_user_backend and _auth_user_id.

from django-mongoengine.

waynetian avatar waynetian commented on June 1, 2024

OK, I will make a simple reproduce steps.

Step.1 Create a test view

class Test(TemplateView):
    def get(self, request, *args, **kwargs):
        test_data = request.session.get('test', None)
        print 'test=%s' %test_data
        request.session['test'] = 'abc123'
        return  HttpResponse('ok')

Step.2 Confirm your session key is None

Step.3 Access the View twice.
Expected Result is:
the first time: test=None
the second time: test='abc123'
Actual Result is:
the first time: test=None
the second time: test=None
the third time: test='abc123'

from django-mongoengine.

last-partizan avatar last-partizan commented on June 1, 2024

Nice, with your test case i confirmed bug.
Looks like it was issue with session caching. Fixed it myself. (your proposed fix was inapropriate)

from django-mongoengine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.