Skip to content

Fix password complexity regex for special characters (backport for v1.10.0) #8524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Oct 16, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Tidy up variable declaration
  • Loading branch information
guillep2k committed Oct 16, 2019
commit 31f4a1a85aeb339d2678ef83f2fb3f31cc1bceb3
20 changes: 11 additions & 9 deletions modules/password/password.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ import (
"code.gitea.io/gitea/modules/setting"
)

var matchComplexityOnce sync.Once
var validChars string
var requiredChars []string
var (
matchComplexityOnce sync.Once
validChars string
requiredChars []string

var charComplexities = map[string]string{
"lower": `abcdefghijklmnopqrstuvwxyz`,
"upper": `ABCDEFGHIJKLMNOPQRSTUVWXYZ`,
"digit": `0123456789`,
"spec": ` !"#$%&'()*+,-./:;<=>?@[\]^_{|}~` + "`",
}
charComplexities = map[string]string{
"lower": `abcdefghijklmnopqrstuvwxyz`,
"upper": `ABCDEFGHIJKLMNOPQRSTUVWXYZ`,
"digit": `0123456789`,
"spec": ` !"#$%&'()*+,-./:;<=>?@[\]^_{|}~` + "`",
}
)

// NewComplexity for preparation
func NewComplexity() {
Expand Down