added authentication for login/logout functionality