added user login and logout functions and base template hierarchy