fix: no auth

License: MIT
Signed-off-by: Henrique Dias <hacdias@gmail.com>
This commit is contained in:
Henrique Dias 2018-12-30 13:57:11 +00:00
parent bf054c6379
commit bc7464d3f5
4 changed files with 6 additions and 5 deletions

View File

@ -9,6 +9,7 @@ import (
// ConfigStore is a configuration store.
type ConfigStore struct {
DB *storm.DB
Users types.UsersStore
}
// Get gets a configuration from the database to an interface.
@ -68,7 +69,7 @@ func (c ConfigStore) GetAuther(t types.AuthMethod) (types.Auther, error) {
}
if t == auth.MethodNoAuth {
auther := auth.NoAuth{}
auther := auth.NoAuth{Store: c.Users}
if err := c.Get("auther", &auther); err != nil {
return nil, err
}

View File

@ -68,7 +68,7 @@ listening on loalhost on a random port. Use the flags to change it.`,
env := &fhttp.Env{
Store: &types.Store{
Users: bolt.UsersStore{DB: db},
Config: bolt.ConfigStore{DB: db},
Config: bolt.ConfigStore{DB: db, Users: bolt.UsersStore{DB: db}},
Share: bolt.ShareStore{DB: db},
},
}

@ -1 +1 @@
Subproject commit daaf341bc3b6a973a9b32dbeb6b02331cedb6b05
Subproject commit 358f3bf714200c6b2e8cafb95ea012e1ef69d3a2

View File

@ -14,7 +14,7 @@ import (
"github.com/filebrowser/filebrowser/types"
)
func (e *Env) getStaticData () map[string]interface{} {
func (e *Env) getStaticData() map[string]interface{} {
baseURL := strings.TrimSuffix(e.Settings.BaseURL, "/")
staticURL := strings.TrimPrefix(baseURL+"/static", "/")
@ -26,6 +26,7 @@ func (e *Env) getStaticData () map[string]interface{} {
"Version": types.Version,
"StaticURL": staticURL,
"Signup": e.Settings.Signup,
"NoAuth": e.Settings.AuthMethod == auth.MethodNoAuth,
"CSS": false,
"ReCaptcha": false,
}
@ -63,7 +64,6 @@ func (e *Env) getStaticHandlers() (http.Handler, http.Handler) {
box := rice.MustFindBox("../frontend/dist")
handler := http.FileServer(box.HTTPBox())
handleWithData := func(w http.ResponseWriter, r *http.Request, file string, contentType string) {
w.Header().Set("Content-Type", contentType)
index := template.Must(template.New("index").Delims("[{[", "]}]").Parse(box.MustString(file)))