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).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.