WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit eb13f10

Browse files
committed
move enable_two_factor, enable_forget_password and forget_password_require_email_verify option to the auth section
1 parent 76ce6f6 commit eb13f10

File tree

2 files changed

+37
-23
lines changed

2 files changed

+37
-23
lines changed

conf/ezbookkeeping.ini

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@ max_failures_per_ip_per_minute = 5
269269
# Maximum count of password / token check failures (0 - 4294967295) per user per minute (use the above duplicate checker), default is 5, set to 0 to disable
270270
max_failures_per_user_per_minute = 5
271271

272+
[auth]
273+
# Set to true to enable two-factor authorization
274+
enable_two_factor = true
275+
276+
# Set to true to allow users to reset password
277+
enable_forget_password = true
278+
279+
# Set to true to require email must be verified when use forget password
280+
forget_password_require_email_verify = false
281+
272282
[user]
273283
# Set to true to allow users to register account by themselves
274284
enable_register = true
@@ -279,15 +289,6 @@ enable_email_verify = false
279289
# Set to true to require email must be verified when login
280290
enable_force_email_verify = false
281291

282-
# Set to true to allow users to reset password
283-
enable_forget_password = true
284-
285-
# Set to true to require email must be verified when use forget password
286-
forget_password_require_email_verify = false
287-
288-
# Set to true to enable two-factor authorization
289-
enable_two_factor = true
290-
291292
# Set to true to allow users to upload transaction pictures
292293
enable_transaction_picture = true
293294

pkg/settings/setting.go

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -349,19 +349,21 @@ type Config struct {
349349
MaxFailuresPerIpPerMinute uint32
350350
MaxFailuresPerUserPerMinute uint32
351351

352-
// User
353-
EnableUserRegister bool
354-
EnableUserVerifyEmail bool
355-
EnableUserForceVerifyEmail bool
352+
// Auth
353+
EnableTwoFactor bool
356354
EnableUserForgetPassword bool
357355
ForgetPasswordRequireVerifyEmail bool
358-
EnableTwoFactor bool
359-
EnableTransactionPictures bool
360-
MaxTransactionPictureFileSize uint32
361-
EnableScheduledTransaction bool
362-
AvatarProvider core.UserAvatarProviderType
363-
MaxAvatarFileSize uint32
364-
DefaultFeatureRestrictions core.UserFeatureRestrictions
356+
357+
// User
358+
EnableUserRegister bool
359+
EnableUserVerifyEmail bool
360+
EnableUserForceVerifyEmail bool
361+
EnableTransactionPictures bool
362+
MaxTransactionPictureFileSize uint32
363+
EnableScheduledTransaction bool
364+
AvatarProvider core.UserAvatarProviderType
365+
MaxAvatarFileSize uint32
366+
DefaultFeatureRestrictions core.UserFeatureRestrictions
365367

366368
// Data
367369
EnableDataExport bool
@@ -499,6 +501,12 @@ func LoadConfiguration(configFilePath string) (*Config, error) {
499501
return nil, err
500502
}
501503

504+
err = loadAuthConfiguration(config, cfgFile, "auth")
505+
506+
if err != nil {
507+
return nil, err
508+
}
509+
502510
err = loadUserConfiguration(config, cfgFile, "user")
503511

504512
if err != nil {
@@ -946,13 +954,18 @@ func loadSecurityConfiguration(config *Config, configFile *ini.File, sectionName
946954
return nil
947955
}
948956

957+
func loadAuthConfiguration(config *Config, configFile *ini.File, sectionName string) error {
958+
config.EnableTwoFactor = getConfigItemBoolValue(configFile, sectionName, "enable_two_factor", true)
959+
config.EnableUserForgetPassword = getConfigItemBoolValue(configFile, sectionName, "enable_forget_password", false)
960+
config.ForgetPasswordRequireVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "forget_password_require_email_verify", false)
961+
962+
return nil
963+
}
964+
949965
func loadUserConfiguration(config *Config, configFile *ini.File, sectionName string) error {
950966
config.EnableUserRegister = getConfigItemBoolValue(configFile, sectionName, "enable_register", false)
951967
config.EnableUserVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "enable_email_verify", false)
952968
config.EnableUserForceVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "enable_force_email_verify", false)
953-
config.EnableUserForgetPassword = getConfigItemBoolValue(configFile, sectionName, "enable_forget_password", false)
954-
config.ForgetPasswordRequireVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "forget_password_require_email_verify", false)
955-
config.EnableTwoFactor = getConfigItemBoolValue(configFile, sectionName, "enable_two_factor", true)
956969
config.EnableTransactionPictures = getConfigItemBoolValue(configFile, sectionName, "enable_transaction_picture", false)
957970
config.MaxTransactionPictureFileSize = getConfigItemUint32Value(configFile, sectionName, "max_transaction_picture_size", defaultTransactionPictureFileMaxSize)
958971
config.EnableScheduledTransaction = getConfigItemBoolValue(configFile, sectionName, "enable_scheduled_transaction", false)

0 commit comments

Comments
 (0)