diff --git a/cmd/explorer/main.go b/cmd/explorer/main.go index 35d539e5f8..d8c998b690 100644 --- a/cmd/explorer/main.go +++ b/cmd/explorer/main.go @@ -497,7 +497,6 @@ func main() { router.HandleFunc("/search/{type}/{search}", handlers.SearchAhead).Methods("GET") router.HandleFunc("/imprint", handlers.Imprint).Methods("GET") router.HandleFunc("/mobile", handlers.MobilePage).Methods("GET") - router.HandleFunc("/mobile", handlers.MobilePagePost).Methods("POST") router.HandleFunc("/tools/unitConverter", handlers.UnitConverter).Methods("GET") router.HandleFunc("/tools/broadcast", handlers.Broadcast).Methods("GET") router.HandleFunc("/tools/broadcast", handlers.BroadcastPost).Methods("POST") diff --git a/handlers/advertisewithus.go b/handlers/advertisewithus.go index 5c83133db9..db11442a13 100644 --- a/handlers/advertisewithus.go +++ b/handlers/advertisewithus.go @@ -39,13 +39,15 @@ func AdvertiseWithUs(w http.ResponseWriter, r *http.Request) { func AdvertiseWithUsPost(w http.ResponseWriter, r *http.Request) { err := r.ParseForm() if err != nil { - utils.LogError(err, "error parsing form", 0) + utils.LogError(err, "error parsing ad request form", 0, map[string]interface{}{ + "route": r.URL.String(), + }) utils.SetFlash(w, r, "ad_flash", "Error: invalid form submitted") http.Redirect(w, r, "/advertisewithus", http.StatusSeeOther) return } - if err := utils.HandleRecaptcha(w, r, "/pricing"); err != nil { + if err := utils.HandleRecaptcha(w, r, "/advertisewithus"); err != nil { return } @@ -66,7 +68,7 @@ func AdvertiseWithUsPost(w http.ResponseWriter, r *http.Request) { // escape html msg = template.HTMLEscapeString(msg) - err = mail.SendTextMail("support@beaconcha.in", "New ad inquiry", msg, []types.EmailAttachment{}) + err = mail.SendTextMail(utils.Config.Frontend.Mail.Contact.InquiryEmail, "New ad inquiry", msg, []types.EmailAttachment{}) if err != nil { logger.Errorf("error sending ad form: %v", err) utils.SetFlash(w, r, "ad_flash", "Error: unable to submit ad request") diff --git a/handlers/mobilepage.go b/handlers/mobilepage.go index b26d1fc38d..9a549ed580 100644 --- a/handlers/mobilepage.go +++ b/handlers/mobilepage.go @@ -1,12 +1,9 @@ package handlers import ( - "eth2-exporter/mail" "eth2-exporter/templates" "eth2-exporter/types" "eth2-exporter/utils" - "fmt" - "html/template" "net/http" ) @@ -33,44 +30,3 @@ func MobilePage(w http.ResponseWriter, r *http.Request) { return // an error has occurred and was processed } } - -func MobilePagePost(w http.ResponseWriter, r *http.Request) { - err := r.ParseForm() - if err != nil { - utils.LogError(err, "error parsing form", 0) - utils.SetFlash(w, r, "ad_flash", "Error: invalid form submitted") - http.Redirect(w, r, "/mobile", http.StatusSeeOther) - return - } - - if err := utils.HandleRecaptcha(w, r, "/pricing"); err != nil { - return - } - - name := r.FormValue("name") - email := r.FormValue("email") - url := r.FormValue("url") - company := r.FormValue("company") - text := r.FormValue("text") - - msg := fmt.Sprintf(`New app pool support inquiry: - Name: %s - Email: %s - Url: %s - Company: %s - Message: %s`, - name, email, url, company, text) - // escape html - msg = template.HTMLEscapeString(msg) - - err = mail.SendTextMail("support@beaconcha.in", "New app pool support inquiry", msg, []types.EmailAttachment{}) - if err != nil { - logger.Errorf("error sending app pool form: %v", err) - utils.SetFlash(w, r, "ad_flash", "Error: unable to submit app pool request") - http.Redirect(w, r, "/mobile", http.StatusSeeOther) - return - } - - utils.SetFlash(w, r, "ad_flash", "Thank you for your inquiry, we will get back to you as soon as possible.") - http.Redirect(w, r, "/mobile", http.StatusSeeOther) -} diff --git a/handlers/pricing.go b/handlers/pricing.go index 8dc56c3bcd..d127ac7186 100644 --- a/handlers/pricing.go +++ b/handlers/pricing.go @@ -113,9 +113,10 @@ func MobilePricing(w http.ResponseWriter, r *http.Request) { func PricingPost(w http.ResponseWriter, r *http.Request) { err := r.ParseForm() if err != nil { - utils.LogError(err, "error parsing form", 0) + utils.LogError(err, "error parsing form for pricing request", 0, map[string]interface{}{ + "route": r.URL.String(), + }) utils.SetFlash(w, r, "pricing_flash", "Error: invalid form submitted") - logger.Errorf("error parsing pricing request form for %v route: %v", r.URL.String(), err) http.Redirect(w, r, "/pricing", http.StatusSeeOther) return } @@ -141,7 +142,7 @@ func PricingPost(w http.ResponseWriter, r *http.Request) { // escape html msg = template.HTMLEscapeString(msg) - err = mail.SendTextMail("inquiries@beaconcha.in", "New API usage inquiry", msg, []types.EmailAttachment{}) + err = mail.SendTextMail(utils.Config.Frontend.Mail.Contact.InquiryEmail, "New API usage inquiry", msg, []types.EmailAttachment{}) if err != nil { logger.Errorf("error sending ad form: %v", err) utils.SetFlash(w, r, "pricing_flash", "Error: unable to submit api request") diff --git a/handlers/stripe.go b/handlers/stripe.go index af11dd67e4..f4061941bf 100644 --- a/handlers/stripe.go +++ b/handlers/stripe.go @@ -536,7 +536,7 @@ func createNewStripeSubscription(subscription stripe.Subscription, event stripe. } func emailCustomerAboutFailedPayment(email string) { - msg := fmt.Sprintf("Payment processing failed. Could not activate your subscription. Please contact support at support@beaconcha.in. Manage Subscription: https://" + utils.Config.Frontend.SiteDomain + "/user/settings") + msg := fmt.Sprintf("Payment processing failed. Could not activate your subscription. Please contact support at " + utils.Config.Frontend.Mail.Contact.SupportEmail + ". Manage Subscription: https://" + utils.Config.Frontend.SiteDomain + "/user/settings") // escape html msg = template.HTMLEscapeString(msg) err := mail.SendTextMail(email, "Failed Payment", msg, []types.EmailAttachment{}) diff --git a/templates/mobilepage.html b/templates/mobilepage.html index 914919b765..fb8efcdeb6 100644 --- a/templates/mobilepage.html +++ b/templates/mobilepage.html @@ -251,48 +251,6 @@
Reach out to us if you are interested in a partnership.
- -