mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2026-10-19 16:14:39 +00:00
feature (plg_backend_local): enable a fast path
This commit is contained in:
@@ -17,13 +17,13 @@ type Local struct {
|
||||
}
|
||||
|
||||
func (this Local) Init(params map[string]string, app *App) (IBackend, error) {
|
||||
if err := bcrypt.CompareHashAndPassword(
|
||||
if this.secret != "" && params["password"] == this.secret {
|
||||
return &Local{}, nil
|
||||
} else if err := bcrypt.CompareHashAndPassword(
|
||||
[]byte(Config.Get("auth.admin").String()),
|
||||
[]byte(params["password"]),
|
||||
); err == nil {
|
||||
return &Local{}, nil
|
||||
} else if this.secret != "" && params["password"] == this.secret {
|
||||
return &Local{}, nil
|
||||
}
|
||||
return nil, ErrAuthenticationFailed
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user