Added register route and template.

This commit is contained in:
mikestefanello 2021-12-03 16:35:11 -05:00
parent fe0fb8c801
commit fc1d3cdc33
7 changed files with 69 additions and 8 deletions

View file

@ -1,6 +1,8 @@
package controllers
import (
"goweb/msg"
"github.com/labstack/echo/v4"
)
@ -17,8 +19,7 @@ func (l *Login) Get(c echo.Context) error {
return l.RenderPage(c, p)
}
//func (a *Contact) Post(c echo.Context) error {
// msg.Set(c, msg.Success, "Thank you for contacting us!")
// msg.Set(c, msg.Info, "We will respond to you shortly.")
// return a.Redirect(c, "home")
//}
func (l *Login) Post(c echo.Context) error {
msg.Set(c, msg.Danger, "Invalid credentials. Please try again.")
return l.Get(c)
}

25
controllers/register.go Normal file
View file

@ -0,0 +1,25 @@
package controllers
import (
"goweb/msg"
"github.com/labstack/echo/v4"
)
type Register struct {
Controller
}
func (r *Register) Get(c echo.Context) error {
p := NewPage(c)
p.Layout = "auth"
p.Name = "register"
p.Title = "Register"
p.Data = "This is the login page"
return r.RenderPage(c, p)
}
func (r *Register) Post(c echo.Context) error {
msg.Set(c, msg.Danger, "Registration is currently disabled.")
return r.Get(c)
}