mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
apply selected theme to the login page
This commit is contained in:
parent
96835ebd33
commit
dc20932060
@ -22,7 +22,7 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="theme-{% .settings.theme_name %}">
|
||||||
<form action="" method="post">
|
<form action="" method="post">
|
||||||
<img src="./static/graphicarts/anchor.svg" alt="">
|
<img src="./static/graphicarts/anchor.svg" alt="">
|
||||||
{% if .error %}
|
{% if .error %}
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/nkanaev/yarr/src/assets"
|
"github.com/nkanaev/yarr/src/assets"
|
||||||
"github.com/nkanaev/yarr/src/server/router"
|
"github.com/nkanaev/yarr/src/server/router"
|
||||||
|
"github.com/nkanaev/yarr/src/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Middleware struct {
|
type Middleware struct {
|
||||||
@ -13,6 +14,7 @@ type Middleware struct {
|
|||||||
Password string
|
Password string
|
||||||
BasePath string
|
BasePath string
|
||||||
Public []string
|
Public []string
|
||||||
|
DB *storage.Storage
|
||||||
}
|
}
|
||||||
|
|
||||||
func unsafeMethod(method string) bool {
|
func unsafeMethod(method string) bool {
|
||||||
@ -46,12 +48,15 @@ func (m *Middleware) Handler(c *router.Context) {
|
|||||||
c.Redirect(rootUrl)
|
c.Redirect(rootUrl)
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
c.HTML(http.StatusOK, assets.Template("login.html"), map[string]string{
|
c.HTML(http.StatusOK, assets.Template("login.html"), map[string]interface{}{
|
||||||
"username": username,
|
"username": username,
|
||||||
"error": "Invalid username/password",
|
"error": "Invalid username/password",
|
||||||
|
"settings": m.DB.GetSettings(),
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c.HTML(http.StatusOK, assets.Template("login.html"), nil)
|
c.HTML(http.StatusOK, assets.Template("login.html"), map[string]interface{}{
|
||||||
|
"settings": m.DB.GetSettings(),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ func (s *Server) handler() http.Handler {
|
|||||||
Username: s.Username,
|
Username: s.Username,
|
||||||
Password: s.Password,
|
Password: s.Password,
|
||||||
Public: []string{"/static", "/fever"},
|
Public: []string{"/static", "/fever"},
|
||||||
|
DB: s.db,
|
||||||
}
|
}
|
||||||
r.Use(a.Handler)
|
r.Use(a.Handler)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user