code UserModel and manage login and logout