add some code to login and logout