ahmed hassaine
ahmed hassaine

Reputation: 19

Use sessions in django in order to check if someone is loged in or not

I tried to create a dictionary key in the request.session:

request.session['key'] = 1232354

When a user navigate into the website, I check if they have the key in order to know if they are logged in.

I'm new to Django and I am afraid that there is some big cons in this idea, like easily getting the web site hacked or something. Is there anything wrong about this idea?

Upvotes: 0

Views: 213

Answers (1)

J Winnie
J Winnie

Reputation: 163

I hate to be the "use X library" guy, but if you're using Django you should be using django.contrib.auth for handling authentication rather than rolling your own, unless you're very experienced with web development and computer security. Authentication is very sensitive in terms of security and Django's authentication system is very well-done and is IMO one of the main strengths of the framework.

Upvotes: 2

Related Questions