Sayyiduna Abu Hurayrah (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings be upon him) said: "The Muslims are bound by their conditions, insofar as they agree with the truth."
This was also narrated through a third, weak route from Sayyidah Aishah and Anas bin Malik (may Allah be pleased with them), attributed to the Prophet (peace and blessings be upon him).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصداق / 14434