<% Class HomeController_Class Public Title Public useLayout ' Contact form state shared with the landing view Private contactErrors Private contactName Private contactEmail Private contactPhone Private contactBusiness Private contactMessage Private contactSent Private Sub Class_Initialize() Title = "PostcardMojo Logo Files" useLayout = False contactErrors = Array() ReDim contactErrors(-1) contactSent = (Request.QueryString("contact") = "sent") End Sub Public Sub Index() %> <% End Sub ' GET /privacy - the privacy policy page. Public Sub Privacy() %> <% End Sub ' GetAntiCSRFToken returns an empty value the first time it creates a token, so read it again. Private Function ContactCsrfToken() ContactCsrfToken = HTMLSecurity().GetAntiCSRFToken("home.contact") If Len(ContactCsrfToken) = 0 Then ContactCsrfToken = HTMLSecurity().GetAntiCSRFToken("home.contact") End Function ' POST /contact - validate the inquiry and email the PostcardMojo team. Public Sub Contact() contactName = Trim(Request.Form("name")) contactEmail = Trim(Request.Form("email")) contactPhone = Trim(Request.Form("phone")) contactBusiness = Trim(Request.Form("business")) contactMessage = Trim(Request.Form("message")) ' Honeypot: real visitors never see or fill this field If Len(Request.Form("zq_trap_field")) > 0 Then Response.Redirect "/?contact=sent#contact" End If If Not HTMLSecurity().IsValidAntiCSRFToken("home.contact", Request.Form("csrf_token")) Then contactErrors = Array("Your session expired. Please try again.") Else contactErrors = ContactInquiryService().ValidationErrors(contactName, contactEmail, contactBusiness, contactMessage) End If If UBound(contactErrors) < 0 Then If ContactInquiryService().Notify(contactName, contactEmail, contactPhone, contactBusiness, contactMessage) Then HTMLSecurity().ClearAntiCSRFToken "home.contact" Response.Redirect "/?contact=sent#contact" End If contactErrors = Array("We could not send your message. Please email danielcovington@postcardmojo.com directly.") End If Index End Sub End Class Dim HomeController_Class__Singleton Function HomeController() If IsEmpty(HomeController_Class__Singleton) Then Set HomeController_Class__Singleton = New HomeController_Class End If Set HomeController = HomeController_Class__Singleton End Function %>