add login and logout functions for admin

and add comments