Closed robbie-wilson closed 10 years ago
You could have it so that visiting a certain URL returns "false" or "failure" if the user is not logged in and the username and email if they are. Saves changing the way the cookie is created/saved and passing session id's between servers/domains.
I don't like the sound of that - it sounds too.. Anti-security. It would be too easy to harvest emails using JS injection.
But surely the session id is random and its not like your going to be able to get any more info than if you have the persons password and just log in as them
Yes, but you don't /need/ the password in this case.
This would just run a script that gets the session id and checks it against the database, I don't see how it is insecure
It's insecure because you're relying on your XSS protection being good enough - it's best not to leave these vectors in the first place. Everyone fucks up.
Okay then, forget the whole url idea then
Agreed with @gdude2002 ;)
The user's rank, (user, admin etc) should be saved with that data aswell.
Well, really, it could just refer to the ObjectID of the user, as well as maybe a date and IP address for session validation - for the sake of efficiency and security - and then we'd just use that to get the specific user data we need from Mongo.
yeah I guess that's does the same thing, @greatman can decide how he wants it to work
It's a database design thing. DRY taken to the max.
'DRY'?
D on't R epeat Y ourself.
Could someone implement it to the logging in section so that when someone logs in it saves the session cookie content to the database making it so that other sections of Statik can check to see if a user is logged in.
The data saved to the database should contain:
Other data can be saved if you see fit.
There should only ever be one instance of each username in the collection at one time, when someone logs in it should replace any previous instance of that user being in that database.
The cookie should be accessible to be read from any sub-domain of statik.io
You may want to create a page that takes the session id and returns the values although this is not mandatory.