updates
This commit is contained in:
27
server/internal/handlers/login_handler.go
Normal file
27
server/internal/handlers/login_handler.go
Normal 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>")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user