summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-03-21 01:09:22 -0400
committerUnknown <joe2010xtmf@163.com>2014-03-21 01:09:22 -0400
commit369ddf76a8ae6916ab72f1fa26c81b44c456c6ea (patch)
tree3e26392ef3ff4569cc077432e507e848f907df8a /modules
parent53a17bbd240e0dd3755b7a666792d69e358f3e00 (diff)
downloadgitea-369ddf76a8ae6916ab72f1fa26c81b44c456c6ea.tar.gz
gitea-369ddf76a8ae6916ab72f1fa26c81b44c456c6ea.zip
Batch fix
Diffstat (limited to 'modules')
-rw-r--r--modules/base/conf.go8
-rw-r--r--modules/base/template.go11
2 files changed, 15 insertions, 4 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go
index 81f32bd591..41b66b69f8 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -39,9 +39,10 @@ var (
)
var Service struct {
- RegisterEmailConfirm bool
- ActiveCodeLives int
- ResetPwdCodeLives int
+ RegisterEmailConfirm bool
+ DisenableRegisteration bool
+ ActiveCodeLives int
+ ResetPwdCodeLives int
}
func exeDir() (string, error) {
@@ -68,6 +69,7 @@ var logLevels = map[string]string{
func newService() {
Service.ActiveCodeLives = Cfg.MustInt("service", "ACTIVE_CODE_LIVE_MINUTES", 180)
Service.ResetPwdCodeLives = Cfg.MustInt("service", "RESET_PASSWD_CODE_LIVE_MINUTES", 180)
+ Service.DisenableRegisteration = Cfg.MustBool("service", "DISENABLE_REGISTERATION", false)
}
func newLogService() {
diff --git a/modules/base/template.go b/modules/base/template.go
index e596d1dada..8d95dbeab7 100644
--- a/modules/base/template.go
+++ b/modules/base/template.go
@@ -33,6 +33,10 @@ func List(l *list.List) chan interface{} {
return c
}
+var mailDomains = map[string]string{
+ "gmail.com": "gmail.com",
+}
+
var TemplateFuncs template.FuncMap = map[string]interface{}{
"AppName": func() string {
return AppName
@@ -56,7 +60,12 @@ var TemplateFuncs template.FuncMap = map[string]interface{}{
"DateFormat": DateFormat,
"List": List,
"Mail2Domain": func(mail string) string {
- return "mail." + strings.Split(mail, "@")[1]
+ suffix := strings.SplitN(mail, "@", 2)[1]
+ domain, ok := mailDomains[suffix]
+ if !ok {
+ return "mail." + suffix
+ }
+ return domain
},
"SubStr": func(str string, start, length int) string {
return str[start : start+length]