Disable password complexity check default (#12557)
* Disable password complexity check default These features enourange bad passwords/are annoying for people using better password methods, and at minimum we shouldn't force that as a default for obvious reasons. Disable any default check to avoid regular complaints. * fix copy paste format
This commit is contained in:
		
							parent
							
								
									7c2cf236f8
								
							
						
					
					
						commit
						fb70b5d207
					
				| 
						 | 
					@ -497,9 +497,9 @@ DISABLE_GIT_HOOKS = false
 | 
				
			||||||
; Set to false to allow pushes to gitea repositories despite having an incomplete environment - NOT RECOMMENDED
 | 
					; Set to false to allow pushes to gitea repositories despite having an incomplete environment - NOT RECOMMENDED
 | 
				
			||||||
ONLY_ALLOW_PUSH_IF_GITEA_ENVIRONMENT_SET = true
 | 
					ONLY_ALLOW_PUSH_IF_GITEA_ENVIRONMENT_SET = true
 | 
				
			||||||
;Comma separated list of character classes required to pass minimum complexity.
 | 
					;Comma separated list of character classes required to pass minimum complexity.
 | 
				
			||||||
;If left empty or no valid values are specified, the default values ("lower,upper,digit,spec") will be used.
 | 
					;If left empty or no valid values are specified, the default is off (no checking)
 | 
				
			||||||
;Use "off" to disable checking.
 | 
					;Classes include "lower,upper,digit,spec"
 | 
				
			||||||
PASSWORD_COMPLEXITY = lower,upper,digit,spec
 | 
					PASSWORD_COMPLEXITY = off
 | 
				
			||||||
; Password Hash algorithm, either "pbkdf2", "argon2", "scrypt" or "bcrypt"
 | 
					; Password Hash algorithm, either "pbkdf2", "argon2", "scrypt" or "bcrypt"
 | 
				
			||||||
PASSWORD_HASH_ALGO = pbkdf2
 | 
					PASSWORD_HASH_ALGO = pbkdf2
 | 
				
			||||||
; Set false to allow JavaScript to read CSRF cookie
 | 
					; Set false to allow JavaScript to read CSRF cookie
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -323,7 +323,7 @@ set name for unique queues. Individual queues will default to
 | 
				
			||||||
- `INTERNAL_TOKEN_URI`: **<empty>**: Instead of defining internal token in the configuration, this configuration option can be used to give Gitea a path to a file that contains the internal token (example value: `file:/etc/gitea/internal_token`)
 | 
					- `INTERNAL_TOKEN_URI`: **<empty>**: Instead of defining internal token in the configuration, this configuration option can be used to give Gitea a path to a file that contains the internal token (example value: `file:/etc/gitea/internal_token`)
 | 
				
			||||||
- `PASSWORD_HASH_ALGO`: **pbkdf2**: The hash algorithm to use \[pbkdf2, argon2, scrypt, bcrypt\].
 | 
					- `PASSWORD_HASH_ALGO`: **pbkdf2**: The hash algorithm to use \[pbkdf2, argon2, scrypt, bcrypt\].
 | 
				
			||||||
- `CSRF_COOKIE_HTTP_ONLY`: **true**: Set false to allow JavaScript to read CSRF cookie.
 | 
					- `CSRF_COOKIE_HTTP_ONLY`: **true**: Set false to allow JavaScript to read CSRF cookie.
 | 
				
			||||||
- `PASSWORD_COMPLEXITY`: **lower,upper,digit,spec**: Comma separated list of character classes required to pass minimum complexity. If left empty or no valid values are specified, the default values will be used. Possible values are: 
 | 
					- `PASSWORD_COMPLEXITY`: **off**: Comma separated list of character classes required to pass minimum complexity. If left empty or no valid values are specified, checking is disabled (off):
 | 
				
			||||||
    - lower - use one or more lower latin characters
 | 
					    - lower - use one or more lower latin characters
 | 
				
			||||||
    - upper - use one or more upper latin characters
 | 
					    - upper - use one or more upper latin characters
 | 
				
			||||||
    - digit - use one or more digits
 | 
					    - digit - use one or more digits
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -825,6 +825,9 @@ func NewContext() {
 | 
				
			||||||
	InternalToken = loadInternalToken(sec)
 | 
						InternalToken = loadInternalToken(sec)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cfgdata := sec.Key("PASSWORD_COMPLEXITY").Strings(",")
 | 
						cfgdata := sec.Key("PASSWORD_COMPLEXITY").Strings(",")
 | 
				
			||||||
 | 
						if len(cfgdata) == 0 {
 | 
				
			||||||
 | 
							cfgdata = []string{"off"}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	PasswordComplexity = make([]string, 0, len(cfgdata))
 | 
						PasswordComplexity = make([]string, 0, len(cfgdata))
 | 
				
			||||||
	for _, name := range cfgdata {
 | 
						for _, name := range cfgdata {
 | 
				
			||||||
		name := strings.ToLower(strings.Trim(name, `"`))
 | 
							name := strings.ToLower(strings.Trim(name, `"`))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue