Add server-side code for login & logout