I just started learning about webservers, tornado in particular.
I want to write a simple webpage with a login function. As described in the Tornado Documentation, I'm creating a secure cookie after the user was successfully loged-in:
self.set_secure_cookie("user", self.get_argument("user"))
But how do I provide the user with a way to log-out? As mentioned before, I'm not familiar with web servers, but as I'm checking this cookie when the user attempts to enter the Main-Page, I guess I'd just have to remove it after the user pressed "logout"?
Unfortunately, I could'nt find anything about this in the tornado documentatoin, nor on SO.
You could reset the cookie to an empty string via
self.clear_cookie("user")
Which would make the call to get_current_user return False
. Take a look at the blog demo for an example (using OAuth, but still relevant).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With