From 6a451aae992cbf4903fa8cf5c4ec5f7a2283e9d7 Mon Sep 17 00:00:00 2001 From: Joerg Lehmann Date: Tue, 8 Jun 2021 09:49:24 +0200 Subject: [PATCH] make more than one email receipient possible --- snippets/tracker.html | 2 +- static/js/tracker.js | 2 +- tracker.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/snippets/tracker.html b/snippets/tracker.html index 6d6b73a..d38c941 100644 --- a/snippets/tracker.html +++ b/snippets/tracker.html @@ -60,7 +60,7 @@
- +
diff --git a/static/js/tracker.js b/static/js/tracker.js index 2ba69ee..a9e8f6f 100644 --- a/static/js/tracker.js +++ b/static/js/tracker.js @@ -8,7 +8,7 @@ function validate(what, text) { } else if (what == 'smsnumber') { var re = /^\+[0-9]{11,11}$/; } else if (what == 'email') { - var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + var re = /^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+([,.](([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+)*$/; } else if (what == 'greenzone') { var re = /^$|^[0-9]+\.[0-9]+,[0-9]+\.[0-9]+,[0-9]+\.[0-9]+,[0-9]+\.[0-9]+$/; } diff --git a/tracker.go b/tracker.go index 0ef9727..a4a2c44 100644 --- a/tracker.go +++ b/tracker.go @@ -110,7 +110,7 @@ func save_tracker_settingsHandler(response http.ResponseWriter, request *http.Re } myemail := email[0] - match2, _ := regexp.MatchString(`^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$`, myemail) + match2, _ := regexp.MatchString(`^(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+([,.](([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}){1,25})+)*$`, myemail) if !(match2) { log.Println("Url Param 'email' is not valid") fmt.Fprintf(response, "{ \"rc\": 15, \"msg\": \"email is not valid, must be in in format max.mustermann@example.com\" }")