Fixup and complete login/logout handlers