Comments (4)
The purpose of the UserSession
model is to be able to keep track of all the sessions a user has running. A UserSession
instance itself does not represent a session, it is merely a pointer to an actual session. As it is not a session, it cannot replace the builtin Session
model. Note that the builtin Session
model is not at all aware of users, it is just a data payload pointed to by a session cookie, and there may or may not be a user attached to that session. The sessions
app itself is not aware of users at all. All in all, I do not see a way of unifying this.
Could you elaborate a bit on potential problems you see, especially curious about the "cleaner implementation" bit.
from django-allauth.
@pennersr Fair enough, I just often end up using django-user-sessions
which brings in a custom SessionEngine
linking User
to Session
.
It's just a cleaner implementation using the swappable session model rather than creating the extra UserSession
instance. Since Django allows for swapping in a different session backend, it seems like it would be cleaner to implement UserSession
as a better session backend (rather than creating extra writes to the DB and extra joins with the separate model).
From taking a quick look, a session backend really only requires that UserSession
inherits from AbstractBaseSession
and a SessionStore
model.
It also wouldn't need an additional middleware (just a single session middleware).
from django-allauth.
Whatever solution is chosen, it must be able to work with different session backends. Many projects use cache based sessions. So, the approach taken by django-user-sessions does not match our requirements. Also see:
jazzband/django-user-sessions#52
As for QSessions mentioned in that ticket, that one offers at least both db
and cache
as backends, but I really do think our current solution is as simple as it gets. It does not require adjustments to your regular sessions setup (e.g. no need to remove django.contrib.sessions
from INSTALLED_APPS
, no need to alter SESSION_ENGINE
).
from django-allauth.
Fair enough, perhaps it's just one of those unnecessary overrides that doesn't derive much in he way of specific value vs the approach here. This is definitely quite a bit simpler!
from django-allauth.
Related Issues (20)
- Check if email is already registered in POST `/account/signup` HOT 1
- Email2 field not being converted to lowercase, comparing fails HOT 4
- Incorrect link to demo in docs HOT 1
- Telegram authentication needs /setdomain for your website. HOT 1
- How to match existing, local accounts to social accounts by username? HOT 2
- Headless mode: reset password not working HOT 2
- is_existing not updating after saving a new user connected to SocialLogin HOT 3
- module 'jwt' has no attribute 'PyJWTError' HOT 1
- Headless Demo: Add ability to delete user
- Headless Logout should return 200 instead of 401 HOT 2
- Adding class for input doesn't word HOT 1
- Document the usage of (dynamic) auth_params such as kc_idp_hint within provider_login_url
- [Headless] Auth not working in headless mode via sessionid cookie HOT 1
- Change in socialaccount providers imports causing pytest error HOT 2
- Allow to customize tokens mock in OAuth2TestsMixin HOT 3
- Google access token and refresh token are not getting saved in `SocialToken` model
- [Suggestion] Signing up should (re)send verification mail HOT 7
- [Suggestion] Make it possible to patch `reverse()` HOT 8
- [Suggestion] Add a small tip about rates when testing HOT 2
- Forcing use of SAML nameID for email HOT 1
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-allauth.