fix validation
This commit is contained in:
@@ -2,6 +2,7 @@ package handlers
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/rideaware/admin-panel/internal/email"
|
"github.com/rideaware/admin-panel/internal/email"
|
||||||
|
|
||||||
@@ -22,7 +23,7 @@ func SendUpdatePost(c *gin.Context) {
|
|||||||
body := c.PostForm("body")
|
body := c.PostForm("body")
|
||||||
|
|
||||||
// validate inputs
|
// validate inputs
|
||||||
if strings.TrimSpace(subject) == "" || strings.TrimSpace(body) == {
|
if strings.TrimSpace(subject) == "" || strings.TrimSpace(body) == "" {
|
||||||
c.HTML(http,StatusBadRequest, "send_update.html",
|
c.HTML(http,StatusBadRequest, "send_update.html",
|
||||||
gin.H{"error": "Subject and message cannot be empty"})
|
gin.H{"error": "Subject and message cannot be empty"})
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user