Two men have appeared in court accused of planning a terrorist attack against Muslim and Jewish targets in Cardiff.