This commit is contained in:
2026-01-24 15:59:05 +02:00
parent cbb3fb3421
commit b59d27d13d
12 changed files with 165 additions and 4 deletions

View File

@@ -0,0 +1,27 @@
package handlers
import (
"net/http"
"github.com/gin-gonic/gin"
)
type LoginHandler struct{}
func NewLoginHandler() *LoginHandler {
return &LoginHandler{}
}
func (lh *LoginHandler) Login(c *gin.Context) {
email := c.PostForm("email")
password := c.PostForm("password")
// Simple check, replace with real auth
if email == "test@example.com" && password == "password" {
c.Header("Content-Type", "text/html")
c.String(http.StatusOK, "<p>Login successful! <a href='/dashboard'>Go to Dashboard</a></p>")
} else {
c.Header("Content-Type", "text/html")
c.String(http.StatusUnauthorized, "<p>Invalid credentials. Try again.</p>")
}
}