extracted sign_in_user method