aboutsummaryrefslogtreecommitdiff
path: root/internal/db/two_factor.go
diff options
context:
space:
mode:
authorᴜɴᴋɴᴡᴏɴ <u@gogs.io>2020-02-22 09:05:26 +0800
committerGitHub <noreply@github.com>2020-02-22 09:05:26 +0800
commit648d9e253c1924b832248f26fee42b2fb64dc3bc (patch)
tree51649fad974cd7284a47d30e412c90e7ab72cd2c /internal/db/two_factor.go
parent5b14cc6f0b7b661beb2640a94bd15660cdb48587 (diff)
conf: overhaul server settings (#5928)
* conf: rename package * Requires Go 1.12 * Fix lint * Fix lint * Overhaul * db: fix tests * Save my work * Fix tests * Server.UnixSocketPermission * Server.LocalRootURL * SSH settings * Server.OfflineMode * Save my work * App.Version * Remove [server] STATIC_ROOT_PATH * Server.LandingURL
Diffstat (limited to 'internal/db/two_factor.go')
-rw-r--r--internal/db/two_factor.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/db/two_factor.go b/internal/db/two_factor.go
index cb539ef6..ae17bef5 100644
--- a/internal/db/two_factor.go
+++ b/internal/db/two_factor.go
@@ -16,7 +16,7 @@ import (
"xorm.io/xorm"
"gogs.io/gogs/internal/db/errors"
- "gogs.io/gogs/internal/setting"
+ "gogs.io/gogs/internal/conf"
"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(setting.SecretKey), secret)
+ decryptSecret, err := com.AESGCMDecrypt(tool.MD5Bytes(conf.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(setting.SecretKey), []byte(secret))
+ encryptSecret, err := com.AESGCMEncrypt(tool.MD5Bytes(conf.SecretKey), []byte(secret))
if err != nil {
return fmt.Errorf("AESGCMEncrypt: %v", err)
}