mirror of
https://github.com/gogs/gogs.git
synced 2026-05-07 05:06:31 +02:00
conf: overhaul security settings
This commit is contained in:
@@ -15,8 +15,8 @@ import (
|
||||
log "unknwon.dev/clog/v2"
|
||||
"xorm.io/xorm"
|
||||
|
||||
"gogs.io/gogs/internal/db/errors"
|
||||
"gogs.io/gogs/internal/conf"
|
||||
"gogs.io/gogs/internal/db/errors"
|
||||
"gogs.io/gogs/internal/tool"
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ func (t *TwoFactor) ValidateTOTP(passcode string) (bool, error) {
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("DecodeString: %v", err)
|
||||
}
|
||||
decryptSecret, err := com.AESGCMDecrypt(tool.MD5Bytes(conf.SecretKey), secret)
|
||||
decryptSecret, err := com.AESGCMDecrypt(tool.MD5Bytes(conf.Security.SecretKey), secret)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("AESGCMDecrypt: %v", err)
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func NewTwoFactor(userID int64, secret string) error {
|
||||
}
|
||||
|
||||
// Encrypt secret
|
||||
encryptSecret, err := com.AESGCMEncrypt(tool.MD5Bytes(conf.SecretKey), []byte(secret))
|
||||
encryptSecret, err := com.AESGCMEncrypt(tool.MD5Bytes(conf.Security.SecretKey), []byte(secret))
|
||||
if err != nil {
|
||||
return fmt.Errorf("AESGCMEncrypt: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user