updated user login logic