Implement the functions of sign in and sign out.