From 080a8fcc098f8669d82946af59062d1264addc49 Mon Sep 17 00:00:00 2001 From: MickaelK Date: Fri, 10 Jul 2026 11:00:17 +1000 Subject: [PATCH] feature (plg_backend_local): enable a fast path --- server/plugin/plg_backend_local/index.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/plugin/plg_backend_local/index.go b/server/plugin/plg_backend_local/index.go index e8a0a05e..138fa0ab 100644 --- a/server/plugin/plg_backend_local/index.go +++ b/server/plugin/plg_backend_local/index.go @@ -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 }