added new membership tests, fix tests, cors for dev

This commit is contained in:
$(pass /github/name)
2024-08-24 21:15:38 +02:00
parent 4274f386f7
commit c03ee0b6d0
8 changed files with 96 additions and 31 deletions

View File

@@ -33,18 +33,18 @@ func (cc *ContactController) RelayContactRequest(c *gin.Context) {
validate := validator.New()
if err := validate.Struct(msgData); err != nil {
logger.Error.Printf("Couldn't validate contact form data: %#v: %v", msgData, err)
c.HTML(http.StatusOK, "contactForm_reply.html", gin.H{"Error": "Form submission failed. Please try again."})
c.HTML(http.StatusNotAcceptable, "contactForm_reply.html", gin.H{"Error": "Form validation failed. Please check again."})
// c.JSON(http.StatusNotAcceptable, gin.H{"error": "Couldn't validate contact form data"})
return
}
if err := cc.EmailService.RelayContactFormMessage(msgData.Email, msgData.Name, msgData.Message); err != nil {
logger.Error.Printf("Couldn't send contact message mail: %v", err)
c.HTML(http.StatusOK, "contactForm_reply.html", gin.H{"Error": "Form submission failed. Please try again."})
c.HTML(http.StatusInternalServerError, "contactForm_reply.html", gin.H{"Error": "Email submission failed. Please try again."})
// c.JSON(http.StatusInternalServerError, gin.H{"error": "Couldn't send mail"})
return
}
// c.JSON(http.StatusAccepted, "Your message has been sent")
c.HTML(http.StatusOK, "contactForm_reply.html", gin.H{"Success": true})
c.HTML(http.StatusAccepted, "contactForm_reply.html", gin.H{"Success": true})
}