Added register route and template.
This commit is contained in:
parent
fe0fb8c801
commit
fc1d3cdc33
7 changed files with 69 additions and 8 deletions
|
|
@ -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
25
controllers/register.go
Normal 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue