mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-04 15:06:37 +08:00
[优化] 移除注册相关功能的代码和配置
This commit is contained in:
@@ -35,7 +35,6 @@ func InitOptionMap() {
|
||||
common.OptionMap["GitHubOAuthEnabled"] = strconv.FormatBool(common.GitHubOAuthEnabled)
|
||||
common.OptionMap["WeChatAuthEnabled"] = strconv.FormatBool(common.WeChatAuthEnabled)
|
||||
common.OptionMap["TurnstileCheckEnabled"] = strconv.FormatBool(common.TurnstileCheckEnabled)
|
||||
common.OptionMap["RegisterEnabled"] = strconv.FormatBool(common.RegisterEnabled)
|
||||
common.OptionMap["SMTPServer"] = ""
|
||||
common.OptionMap["SMTPPort"] = strconv.Itoa(common.SMTPPort)
|
||||
common.OptionMap["SMTPAccount"] = ""
|
||||
@@ -187,8 +186,6 @@ func updateOptionMap(key string, value string) {
|
||||
common.WeChatAuthEnabled = boolValue
|
||||
case "TurnstileCheckEnabled":
|
||||
common.TurnstileCheckEnabled = boolValue
|
||||
case "RegisterEnabled":
|
||||
common.RegisterEnabled = boolValue
|
||||
}
|
||||
}
|
||||
switch key {
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"openflare/common"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestInitOptionMapDefaultsRegisterDisabled(t *testing.T) {
|
||||
previousRegisterEnabled := common.RegisterEnabled
|
||||
previousOptionMap := common.OptionMap
|
||||
previousDB := DB
|
||||
t.Cleanup(func() {
|
||||
common.RegisterEnabled = previousRegisterEnabled
|
||||
common.OptionMap = previousOptionMap
|
||||
DB = previousDB
|
||||
})
|
||||
|
||||
DB = openTestSQLiteDB(t, "options-defaults.db")
|
||||
common.RegisterEnabled = false
|
||||
common.OptionMap = nil
|
||||
|
||||
InitOptionMap()
|
||||
|
||||
if got := common.OptionMap["RegisterEnabled"]; got != "false" {
|
||||
t.Fatalf("expected RegisterEnabled default to be false, got %q", got)
|
||||
}
|
||||
if common.RegisterEnabled {
|
||||
t.Fatal("expected RegisterEnabled to remain false after InitOptionMap")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user