Add dashboard

This commit is contained in:
Jan Bader 2016-12-20 20:05:15 +01:00
parent 135b1b8e8d
commit ca1c2ed778
2 changed files with 31 additions and 0 deletions

View File

@ -31,6 +31,7 @@ func (h *Handler) Serve() {
router.GET("/", func(c *gin.Context) { c.HTML(http.StatusOK, "index", nil) })
router.GET("/login", h.login)
router.GET("/register", h.register)
router.GET("/dashboard", h.dashboard)
api := router.Group("/api/v1")
{
api.GET("/logout", logout)
@ -53,6 +54,16 @@ func (h *Handler) Serve() {
router.Run(":1323")
}
func (h *Handler) dashboard(c *gin.Context) {
token, err := h.verifyLogin(c)
if err != nil {
c.Redirect(http.StatusTemporaryRedirect, "/login")
return
}
c.HTML(http.StatusOK, "dashboard", token)
}
func (h *Handler) restricted(c *gin.Context) {
token, err := h.verifyLogin(c)
if err != nil {

20
templates/dashboard.html Normal file
View File

@ -0,0 +1,20 @@
{{define "dashboard"}}
<!DOCTYPE html>
<html>
<head>
<title>Registration</title>
{{template "head"}}
</head>
<body>
<div class="container" id="head">
Budgeteer - {{.GetName}}
</div>
<div class="container col-lg-12" id="content">
<ul>Budgets
<li>Test</li>
</ul>
</div>
</body>
</html>
{{end}}