diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-19 07:21:23 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-19 07:21:23 -0400 |
commit | fbbae2b721c04be740d67b9d227a7578030f93b9 (patch) | |
tree | 394b9bb1e2e3b36611d834027ecaf6ee34a8a41d /modules/base/conf.go | |
parent | 9a666f33773c5d8b66e9ab66598414f62bcfdc11 (diff) |
Working on register mail confirmation
Diffstat (limited to 'modules/base/conf.go')
-rw-r--r-- | modules/base/conf.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go index 9f6de56b..ee5638ed 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -28,11 +28,20 @@ type Mailer struct { var ( AppVer string AppName string + AppLogo string + AppUrl string Domain string + SecretKey string Cfg *goconfig.ConfigFile MailService *Mailer ) +var Service struct { + RegisterEmailConfitm bool + ActiveCodeLives int + ResetPwdCodeLives int +} + func exeDir() (string, error) { file, err := exec.LookPath(os.Args[0]) if err != nil { @@ -54,6 +63,11 @@ var logLevels = map[string]string{ "Critical": "5", } +func newService() { + Service.ActiveCodeLives = Cfg.MustInt("service", "ACTIVE_CODE_LIVE_MINUTES", 180) + Service.ResetPwdCodeLives = Cfg.MustInt("service", "RESET_PASSWD_CODE_LIVE_MINUTES", 180) +} + func newLogService() { // Get and check log mode. mode := Cfg.MustValue("log", "MODE", "console") @@ -117,6 +131,17 @@ func newMailService() { } } +func newRegisterService() { + if !Cfg.MustBool("service", "REGISTER_EMAIL_CONFIRM") { + return + } else if MailService == nil { + log.Warn("Register Service: Mail Service is not enabled") + return + } + Service.RegisterEmailConfitm = true + log.Info("Register Service Enabled") +} + func init() { var err error workDir, err := exeDir() @@ -143,9 +168,13 @@ func init() { Cfg.BlockMode = false AppName = Cfg.MustValue("", "APP_NAME", "Gogs: Go Git Service") + AppLogo = Cfg.MustValue("", "APP_LOGO", "img/favicon.png") + AppUrl = Cfg.MustValue("server", "ROOT_URL") Domain = Cfg.MustValue("server", "DOMAIN") + SecretKey = Cfg.MustValue("security", "SECRET_KEY") // Extensions. newLogService() newMailService() + newRegisterService() } |