diff --git a/js/qsm-quiz.js b/js/qsm-quiz.js
index 171674df1..d29d022d3 100644
--- a/js/qsm-quiz.js
+++ b/js/qsm-quiz.js
@@ -596,13 +596,28 @@ function isValidDomains(email, domains) {
if (0 == domains.length) {
return true;
}
- for (var i = 0; i < domains.length; i++) {
+ for (let i = 0; i < domains.length; i++) {
if (email.indexOf(domains[i]) != -1) {
return true;
}
}
return false;
}
+function isBlockedDomain(email, blockdomains) {
+ if (typeof blockdomains === 'undefined') {
+ return false;
+ }
+ if (blockdomains.length === 0) {
+ return false;
+ }
+ for (let i = 0; i < blockdomains.length; i++) {
+ if (email.indexOf(blockdomains[i]) !== -1) {
+ return true;
+ }
+ }
+ return false;
+}
+
/**
* Validates a URL.
*
@@ -732,6 +747,16 @@ function qmnValidation(element, quiz_form_id) {
show_result_validation = false;
}
}
+ /**
+ * Validate email from blocked domains.
+ */
+ let blockdomains = jQuery(this).attr('data-blockdomains');
+ if (typeof blockdomains !== 'undefined') {
+ if (isBlockedDomain(x, blockdomains.split(","))) {
+ qmnDisplayError(error_messages.email_error_text, jQuery(this), quiz_form_id);
+ show_result_validation = false;
+ }
+ }
}
if (jQuery(this).attr('class').indexOf('mlwUrl') !== -1 && this.value !== "") {
// Remove any trailing and preceeding space.
diff --git a/php/admin/options-page-contact-tab.php b/php/admin/options-page-contact-tab.php
index 7e643a536..a6d8966e2 100644
--- a/php/admin/options-page-contact-tab.php
+++ b/php/admin/options-page-contact-tab.php
@@ -200,6 +200,11 @@ function qsm_options_contact_tab_template() {
+