Skip to content

Commit fb70b5d

Browse files
authored
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
1 parent 7c2cf23 commit fb70b5d

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

custom/conf/app.example.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -497,9 +497,9 @@ DISABLE_GIT_HOOKS = false
497497
; Set to false to allow pushes to gitea repositories despite having an incomplete environment - NOT RECOMMENDED
498498
ONLY_ALLOW_PUSH_IF_GITEA_ENVIRONMENT_SET = true
499499
;Comma separated list of character classes required to pass minimum complexity.
500-
;If left empty or no valid values are specified, the default values ("lower,upper,digit,spec") will be used.
501-
;Use "off" to disable checking.
502-
PASSWORD_COMPLEXITY = lower,upper,digit,spec
500+
;If left empty or no valid values are specified, the default is off (no checking)
501+
;Classes include "lower,upper,digit,spec"
502+
PASSWORD_COMPLEXITY = off
503503
; Password Hash algorithm, either "pbkdf2", "argon2", "scrypt" or "bcrypt"
504504
PASSWORD_HASH_ALGO = pbkdf2
505505
; Set false to allow JavaScript to read CSRF cookie

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ set name for unique queues. Individual queues will default to
323323
- `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`)
324324
- `PASSWORD_HASH_ALGO`: **pbkdf2**: The hash algorithm to use \[pbkdf2, argon2, scrypt, bcrypt\].
325325
- `CSRF_COOKIE_HTTP_ONLY`: **true**: Set false to allow JavaScript to read CSRF cookie.
326-
- `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:
326+
- `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):
327327
- lower - use one or more lower latin characters
328328
- upper - use one or more upper latin characters
329329
- digit - use one or more digits

modules/setting/setting.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,9 @@ func NewContext() {
825825
InternalToken = loadInternalToken(sec)
826826

827827
cfgdata := sec.Key("PASSWORD_COMPLEXITY").Strings(",")
828+
if len(cfgdata) == 0 {
829+
cfgdata = []string{"off"}
830+
}
828831
PasswordComplexity = make([]string, 0, len(cfgdata))
829832
for _, name := range cfgdata {
830833
name := strings.ToLower(strings.Trim(name, `"`))

0 commit comments

Comments
 (0)