write login & logout function
fix some bug