diff --git a/mailpoet/assets/js/src/newsletter_editor/blocks/coupon/usage_restriction.tsx b/mailpoet/assets/js/src/newsletter_editor/blocks/coupon/usage_restriction.tsx index e990845d13..aa77eaf1c3 100644 --- a/mailpoet/assets/js/src/newsletter_editor/blocks/coupon/usage_restriction.tsx +++ b/mailpoet/assets/js/src/newsletter_editor/blocks/coupon/usage_restriction.tsx @@ -75,7 +75,9 @@ class UsageRestriction extends Component { componentDidMount() { const $inputs = jQuery( - '.mailpoet_field_coupon_minimum_amount input, .mailpoet_field_coupon_maximum_amount input', + '.mailpoet_field_coupon_minimum_amount input,' + + '.mailpoet_field_coupon_maximum_amount input,' + + '.mailpoet_field_coupon_email_restrictions input', ); if ($inputs.length) { $inputs.each((_index, input) => { @@ -113,6 +115,7 @@ class UsageRestriction extends Component { { this.setValueCallback('emailRestrictions', emailRestrictions); this.setState({ emailRestrictions }); }} + type="text" + pattern="^[-\w+.%\*]+@[\w-.\*]+\.[A-Za-z\*]{2,4}(?:,[-\w+.%\*]+@[\w-.\*]+\.[A-Za-z\*]{2,4})*$" + data-parsley-validate + data-parsley-trigger="input" + data-parsley-error-message={MailPoet.I18n.t( + 'emailRestrictionsFieldsErrorMessage', + )} /> diff --git a/mailpoet/views/newsletter/editor.html b/mailpoet/views/newsletter/editor.html index 880a3b71c1..69795e10fa 100644 --- a/mailpoet/views/newsletter/editor.html +++ b/mailpoet/views/newsletter/editor.html @@ -464,6 +464,7 @@ 'noCategories': __('No categories'), 'allowedEmails': __('Allowed emails'), 'noRestrictions': __('No restrictions'), + 'emailRestrictionsFieldsErrorMessage': __('Separate email addresses with commas. You can also use an asterisk (*) to match parts of an email. For example "*@gmail.com" would match all gmail addresses.'), }) %> <% endblock %>