Jackie • Link
It seems to be a concatenation of several separate stories:
Charles I was not restored - his head was cut off, making restoration tricky for him. He was married, legally to the Queen Henrietta Maria and appears to have lived a rather exemplary private life by the standards of his day. He even seems to have been faithful (unusual in powerful men of that time).
Charles II was famous for his huge string of mistresses and most of today's Dukedoms are descended from his bastards. Charles was always generous in his provision for his bastards and didn't hesitate to acknowledge them (and give them titles after the restoration). The oldest of his acknowledged bastards was the Duke of Monmouth. When the Catholic James II was about to take the throne, various people plotted to put him on the throne instead by claiming that Charles II had married the mother of Monmouth. It was a very flimsy thing, as Charles was always aware that he had to make a royal marriage and as he had no legitimate heirs was unwilling to take his brother James out of the succession on behalf of any of his natural children. If Charles had been married to somebody else at any point, then his children would have been able to take the throne and given his misgivings (well founded!) about his brother, he'd have surely insisted on his sons inheriting instead!
James II did famously marry a commoner while in exile (and then tried to deny it after the restoration). He married Anne Hyde, daughter of the future Earl of Clarendon. James behaved very shabbily towards her in trying to claim that she'd been unfaithful with all and sundry. Charles II looked into it and when he was satisfied that it was a genuine marriage told his brother to "sup as ye have brewed".
This sounds like a story which leans heavily on two separate items firstly Charles II was famously unfaithful to his wife and that James II married a commoner in exile. However, James II's daughters were Mary II (who co-ruled with her husband William of Orange) and Ann who was the first Queen who was married and ruled in her name, without sharing that rule with her husband at all.