summaryrefslogtreecommitdiffstats
path: root/modules/setting/setting.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/setting/setting.go')
-rw-r--r--modules/setting/setting.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go
index 8c61bdbb77..278ed4b107 100644
--- a/modules/setting/setting.go
+++ b/modules/setting/setting.go
@@ -146,6 +146,7 @@ var (
MinPasswordLength int
ImportLocalPaths bool
DisableGitHooks bool
+ PasswordComplexity map[string]string
PasswordHashAlgo string
// UI settings
@@ -774,6 +775,27 @@ func NewContext() {
InternalToken = loadInternalToken(sec)
+ var dictPC = map[string]string{
+ "lower": "[a-z]+",
+ "upper": "[A-Z]+",
+ "digit": "[0-9]+",
+ "spec": `][ !"#$%&'()*+,./:;<=>?@\\^_{|}~` + "`-",
+ }
+ PasswordComplexity = make(map[string]string)
+ cfgdata := sec.Key("PASSWORD_COMPLEXITY").Strings(",")
+ for _, y := range cfgdata {
+ ts := strings.TrimSpace(y)
+ for a := range dictPC {
+ if strings.ToLower(ts) == a {
+ PasswordComplexity[ts] = dictPC[ts]
+ break
+ }
+ }
+ }
+ if len(PasswordComplexity) == 0 {
+ PasswordComplexity = dictPC
+ }
+
sec = Cfg.Section("attachment")
AttachmentPath = sec.Key("PATH").MustString(path.Join(AppDataPath, "attachments"))
if !filepath.IsAbs(AttachmentPath) {