mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 16:54:25 +08:00
move enable_two_factor, enable_forget_password and forget_password_require_email_verify option to the auth section
This commit is contained in:
+10
-9
@@ -269,6 +269,16 @@ max_failures_per_ip_per_minute = 5
|
|||||||
# 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
|
# 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
|
||||||
max_failures_per_user_per_minute = 5
|
max_failures_per_user_per_minute = 5
|
||||||
|
|
||||||
|
[auth]
|
||||||
|
# Set to true to enable two-factor authorization
|
||||||
|
enable_two_factor = true
|
||||||
|
|
||||||
|
# Set to true to allow users to reset password
|
||||||
|
enable_forget_password = true
|
||||||
|
|
||||||
|
# Set to true to require email must be verified when use forget password
|
||||||
|
forget_password_require_email_verify = false
|
||||||
|
|
||||||
[user]
|
[user]
|
||||||
# Set to true to allow users to register account by themselves
|
# Set to true to allow users to register account by themselves
|
||||||
enable_register = true
|
enable_register = true
|
||||||
@@ -279,15 +289,6 @@ enable_email_verify = false
|
|||||||
# Set to true to require email must be verified when login
|
# Set to true to require email must be verified when login
|
||||||
enable_force_email_verify = false
|
enable_force_email_verify = false
|
||||||
|
|
||||||
# Set to true to allow users to reset password
|
|
||||||
enable_forget_password = true
|
|
||||||
|
|
||||||
# Set to true to require email must be verified when use forget password
|
|
||||||
forget_password_require_email_verify = false
|
|
||||||
|
|
||||||
# Set to true to enable two-factor authorization
|
|
||||||
enable_two_factor = true
|
|
||||||
|
|
||||||
# Set to true to allow users to upload transaction pictures
|
# Set to true to allow users to upload transaction pictures
|
||||||
enable_transaction_picture = true
|
enable_transaction_picture = true
|
||||||
|
|
||||||
|
|||||||
+27
-14
@@ -349,19 +349,21 @@ type Config struct {
|
|||||||
MaxFailuresPerIpPerMinute uint32
|
MaxFailuresPerIpPerMinute uint32
|
||||||
MaxFailuresPerUserPerMinute uint32
|
MaxFailuresPerUserPerMinute uint32
|
||||||
|
|
||||||
// User
|
// Auth
|
||||||
EnableUserRegister bool
|
EnableTwoFactor bool
|
||||||
EnableUserVerifyEmail bool
|
|
||||||
EnableUserForceVerifyEmail bool
|
|
||||||
EnableUserForgetPassword bool
|
EnableUserForgetPassword bool
|
||||||
ForgetPasswordRequireVerifyEmail bool
|
ForgetPasswordRequireVerifyEmail bool
|
||||||
EnableTwoFactor bool
|
|
||||||
EnableTransactionPictures bool
|
// User
|
||||||
MaxTransactionPictureFileSize uint32
|
EnableUserRegister bool
|
||||||
EnableScheduledTransaction bool
|
EnableUserVerifyEmail bool
|
||||||
AvatarProvider core.UserAvatarProviderType
|
EnableUserForceVerifyEmail bool
|
||||||
MaxAvatarFileSize uint32
|
EnableTransactionPictures bool
|
||||||
DefaultFeatureRestrictions core.UserFeatureRestrictions
|
MaxTransactionPictureFileSize uint32
|
||||||
|
EnableScheduledTransaction bool
|
||||||
|
AvatarProvider core.UserAvatarProviderType
|
||||||
|
MaxAvatarFileSize uint32
|
||||||
|
DefaultFeatureRestrictions core.UserFeatureRestrictions
|
||||||
|
|
||||||
// Data
|
// Data
|
||||||
EnableDataExport bool
|
EnableDataExport bool
|
||||||
@@ -499,6 +501,12 @@ func LoadConfiguration(configFilePath string) (*Config, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = loadAuthConfiguration(config, cfgFile, "auth")
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
err = loadUserConfiguration(config, cfgFile, "user")
|
err = loadUserConfiguration(config, cfgFile, "user")
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -946,13 +954,18 @@ func loadSecurityConfiguration(config *Config, configFile *ini.File, sectionName
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func loadAuthConfiguration(config *Config, configFile *ini.File, sectionName string) error {
|
||||||
|
config.EnableTwoFactor = getConfigItemBoolValue(configFile, sectionName, "enable_two_factor", true)
|
||||||
|
config.EnableUserForgetPassword = getConfigItemBoolValue(configFile, sectionName, "enable_forget_password", false)
|
||||||
|
config.ForgetPasswordRequireVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "forget_password_require_email_verify", false)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func loadUserConfiguration(config *Config, configFile *ini.File, sectionName string) error {
|
func loadUserConfiguration(config *Config, configFile *ini.File, sectionName string) error {
|
||||||
config.EnableUserRegister = getConfigItemBoolValue(configFile, sectionName, "enable_register", false)
|
config.EnableUserRegister = getConfigItemBoolValue(configFile, sectionName, "enable_register", false)
|
||||||
config.EnableUserVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "enable_email_verify", false)
|
config.EnableUserVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "enable_email_verify", false)
|
||||||
config.EnableUserForceVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "enable_force_email_verify", false)
|
config.EnableUserForceVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "enable_force_email_verify", false)
|
||||||
config.EnableUserForgetPassword = getConfigItemBoolValue(configFile, sectionName, "enable_forget_password", false)
|
|
||||||
config.ForgetPasswordRequireVerifyEmail = getConfigItemBoolValue(configFile, sectionName, "forget_password_require_email_verify", false)
|
|
||||||
config.EnableTwoFactor = getConfigItemBoolValue(configFile, sectionName, "enable_two_factor", true)
|
|
||||||
config.EnableTransactionPictures = getConfigItemBoolValue(configFile, sectionName, "enable_transaction_picture", false)
|
config.EnableTransactionPictures = getConfigItemBoolValue(configFile, sectionName, "enable_transaction_picture", false)
|
||||||
config.MaxTransactionPictureFileSize = getConfigItemUint32Value(configFile, sectionName, "max_transaction_picture_size", defaultTransactionPictureFileMaxSize)
|
config.MaxTransactionPictureFileSize = getConfigItemUint32Value(configFile, sectionName, "max_transaction_picture_size", defaultTransactionPictureFileMaxSize)
|
||||||
config.EnableScheduledTransaction = getConfigItemBoolValue(configFile, sectionName, "enable_scheduled_transaction", false)
|
config.EnableScheduledTransaction = getConfigItemBoolValue(configFile, sectionName, "enable_scheduled_transaction", false)
|
||||||
|
|||||||
Reference in New Issue
Block a user