Comments (5)
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.
OK, I find the issue in my two website projects. I use django-mongoengine as my session engine.
You can reproduce as the follows:
- First (The most important!!!), confirm you access the site without session key.
- 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.
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.
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.
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.
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)
- How does the Permission are automatically made in auth module? HOT 1
- get_deleted_objects needs to be changed for admin view HOT 1
- Appconfig models is empty OrderedDict HOT 4
- Too slow with >1K documents! HOT 2
- unable to createsuperuser HOT 1
- Sub query using mongoengine
- fixes for django:3.1 import FieldDoesNotExist
- FieldDoesNotExist import Exception HOT 1
- there are many RemovedInDjango40Warning warnings HOT 2
- something wrong with django_mongoengine/forms/document_options.py HOT 4
- mongo-admin from django_mongoengine not supporting FieldList. Throwing ValidationError for list HOT 3
- Cannot import EMPTY_CHANGELIST_VALUE in django VERSION = (3, 0, 8, 'final', 0) HOT 2
- Is this package still maintained? HOT 1
- Admin pagination seems to be off by one. HOT 2
- Do not recommend djongo in the readme. HOT 1
- Is this project alive? HOT 4
- UI issue HOT 2
- Using list in a "not_contains" query HOT 1
- ModuleNotFoundError: No module named 'typing_extensions' HOT 3
- '_thread._local' object has no attribute 'no_dereferencing_class' for simple querryset HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-mongoengine.