fully working login/logout