Don't block site admin's operation if SECRET_KEY is lost (#35721)

Related: #24573
This commit is contained in:
wxiaoguang
2025-10-22 12:35:56 +08:00
committed by GitHub
parent c28aab6714
commit 5f0697243c
4 changed files with 13 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ import (
"code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/secret"
"code.gitea.io/gitea/modules/setting"
)
@@ -66,9 +67,12 @@ func (source *Source) FromDB(bs []byte) error {
}
if source.BindPasswordEncrypt != "" {
source.BindPassword, err = secret.DecryptSecret(setting.SecretKey, source.BindPasswordEncrypt)
if err != nil {
log.Error("Unable to decrypt bind password for LDAP source, maybe SECRET_KEY is wrong: %v", err)
}
source.BindPasswordEncrypt = ""
}
return err
return nil
}
// ToDB exports a LDAPConfig to a serialized format.