Women in nifaas fasting if the bleeding stops before forty days
If a woman who is in nifaas (i.e., bleeding following childbirth) sees al-tuhr (end of bleeding) before forty days had passed, she should do ghusl and pray and fast. The tuhr – following menstruation or nifaas – is recognised by one of two signs:
2.Complete dryness, in the sense that there is no trace of blood, or yellowish or brownish discharge.
Al-Nawawi (may Allah have mercy on him) said: The sign that menses has ended and tuhr (purity) has begun is the cessation of bleeding and of yellowish and brownish discharge. If it stops, then the woman has become pure, regardless of whether any white discharge comes after that or not.
End quote from al-Majmoo‘, 2/562
If in the case asked about the bleeding had stopped, and there was no longer any trace of it or any yellowish or brownish discharge, that this was the sign of tuhr (i.e., she had become pure), and her fast is valid in that case, and it does not matter if there was any white discharge, because that is normal secretion from the vagina.
And Allah knows best.
Don't miss out to watch Islamhelpline sponsored Islamic Kids Competition