فهرست منبع

[Web] Complain about non-email email fields

andryyy 5 سال پیش
والد
کامیت
157d2579e4
2فایلهای تغییر یافته به همراه23 افزوده شده و 5 حذف شده
  1. 5 5
      data/web/inc/functions.quarantine.inc.php
  2. 18 0
      data/web/js/build/012-api.js

+ 5 - 5
data/web/inc/functions.quarantine.inc.php

@@ -298,11 +298,11 @@ function quarantine($_action, $_data = null) {
         $max_size = $_data['max_size'];
         $max_size = $_data['max_size'];
         $max_age = intval($_data['max_age']);
         $max_age = intval($_data['max_age']);
         $subject = $_data['subject'];
         $subject = $_data['subject'];
-        if (!filter_var($_data['global_rcpt'], FILTER_VALIDATE_EMAIL)) {
-          $global_rcpt = '';
+        if (!filter_var($_data['bcc'], FILTER_VALIDATE_EMAIL)) {
+          $bcc = '';
         }
         }
         else {
         else {
-          $global_rcpt = $_data['global_rcpt'];
+          $bcc = $_data['bcc'];
         }
         }
         if (!filter_var($_data['sender'], FILTER_VALIDATE_EMAIL)) {
         if (!filter_var($_data['sender'], FILTER_VALIDATE_EMAIL)) {
           $sender = '';
           $sender = '';
@@ -322,7 +322,7 @@ function quarantine($_action, $_data = null) {
           $redis->Set('Q_EXCLUDE_DOMAINS', json_encode($exclude_domains));
           $redis->Set('Q_EXCLUDE_DOMAINS', json_encode($exclude_domains));
           $redis->Set('Q_RELEASE_FORMAT', $release_format);
           $redis->Set('Q_RELEASE_FORMAT', $release_format);
           $redis->Set('Q_SENDER', $sender);
           $redis->Set('Q_SENDER', $sender);
-          $redis->Set('Q_GLOBAL_RCPT', $global_rcpt);
+          $redis->Set('Q_BCC', $bcc);
           $redis->Set('Q_SUBJ', $subject);
           $redis->Set('Q_SUBJ', $subject);
           $redis->Set('Q_HTML', $html);
           $redis->Set('Q_HTML', $html);
         }
         }
@@ -691,7 +691,7 @@ function quarantine($_action, $_data = null) {
         $settings['release_format'] = $redis->Get('Q_RELEASE_FORMAT');
         $settings['release_format'] = $redis->Get('Q_RELEASE_FORMAT');
         $settings['subject'] = $redis->Get('Q_SUBJ');
         $settings['subject'] = $redis->Get('Q_SUBJ');
         $settings['sender'] = $redis->Get('Q_SENDER');
         $settings['sender'] = $redis->Get('Q_SENDER');
-        $settings['global_rcpt'] = $redis->Get('Q_GLOBAL_RCPT');
+        $settings['bcc'] = $redis->Get('Q_BCC');
         $settings['html_tmpl'] = htmlspecialchars($redis->Get('Q_HTML'));
         $settings['html_tmpl'] = htmlspecialchars($redis->Get('Q_HTML'));
         if (empty($settings['html_tmpl'])) {
         if (empty($settings['html_tmpl'])) {
           $settings['html_tmpl'] = htmlspecialchars(file_get_contents("/tpls/quarantine.tpl"));
           $settings['html_tmpl'] = htmlspecialchars(file_get_contents("/tpls/quarantine.tpl"));

+ 18 - 0
data/web/js/build/012-api.js

@@ -99,6 +99,15 @@ $(document).ready(function() {
             $(this).removeClass('inputMissingAttr');
             $(this).removeClass('inputMissingAttr');
           }
           }
         }
         }
+        if ($(this).attr("type") == 'email') {
+          var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
+          if (!emailReg.test($(this).val())) {
+            invalid = true;
+            $(this).addClass('inputMissingAttr');
+          } else {
+            $(this).removeClass('inputMissingAttr');
+          }
+        }
         if ($(this).attr("max")) {
         if ($(this).attr("max")) {
           if (Number($(this).val()) > Number($(this).attr("max"))) {
           if (Number($(this).val()) > Number($(this).attr("max"))) {
             invalid = true;
             invalid = true;
@@ -191,6 +200,15 @@ $(document).ready(function() {
             $(this).removeClass('inputMissingAttr');
             $(this).removeClass('inputMissingAttr');
           }
           }
         }
         }
+        if ($(this).attr("type") == 'email') {
+          var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
+          if (!emailReg.test($(this).val())) {
+            invalid = true;
+            $(this).addClass('inputMissingAttr');
+          } else {
+            $(this).removeClass('inputMissingAttr');
+          }
+        }
         if ($(this).attr("max")) {
         if ($(this).attr("max")) {
           if (Number($(this).val()) > Number($(this).attr("max"))) {
           if (Number($(this).val()) > Number($(this).attr("max"))) {
             invalid = true;
             invalid = true;