package server import ( "fmt" "net/http" "github.com/labstack/echo/v4" "github.com/rjNemo/rentease/internal/view" ) func handleLoginPage() echo.HandlerFunc { return func(c echo.Context) error { return renderTempl(c, http.StatusOK, view.Login()) } } func handleLogin() echo.HandlerFunc { return func(c echo.Context) error { email := c.FormValue("email") _ = c.FormValue("password") //user, err := s.us.SignIn(email, pwd) user := struct{ Id int }{Id: 1} var err error = nil if err != nil { return c.Redirect(http.StatusSeeOther, fmt.Sprintf("%s?err=invalid+credentials", "/login")) } if err = writeCookie(c, user.Id, email); err != nil { return c.Redirect(http.StatusSeeOther, fmt.Sprintf("%s?err=invalid+credentials", "/login")) } return c.Redirect(http.StatusFound, "/bookings") } }