forked from forgejo/forgejo
[GITEA] add option for banning dots in usernames
Refs: https://codeberg.org/forgejo/forgejo/pulls/676 Author: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net> Date: Mon Jun 12 13:57:01 2023 +0200 Co-authored-by: Gusted <postmaster@gusted.xyz> (cherry picked from commitfabdda5c6e
) (cherry picked from commitd2c7f45621
) (cherry picked from commitdfdbaba3d6
) (cherry picked from commita3cda092b8
) (cherry picked from commitf0fdb5905c
) (cherry picked from commit9697e48c1f
) (cherry picked from commit46e31009a8
) (cherry picked from commit5bb2c54b6f
) (cherry picked from commit682f9d24e1
) (cherry picked from commit1863481005
) (cherry picked from commit4f1b7c4ddb
) (cherry picked from commit6afe70bbf1
) (cherry picked from commit5cec1d9c2d
) Conflicts: templates/admin/config.tmpl https://codeberg.org/forgejo/forgejo/pulls/1512 (cherry picked from commitde2d172473
) (cherry picked from commit37a3172dd9
) (cherry picked from commit92dfca0c5a
) (cherry picked from commita713d59b0c
) (cherry picked from commitbf18b10982
) (cherry picked from commit11d77f40a1
) (cherry picked from commit17ca5ff2d6
) (cherry picked from commitfc50a7f74e
)
This commit is contained in:
parent
7d86cbbba1
commit
97496c6c62
7 changed files with 57 additions and 5 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/translation"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/validation"
|
||||
|
@ -135,7 +136,11 @@ func Validate(errs binding.Errors, data map[string]any, f Form, l translation.Lo
|
|||
case validation.ErrRegexPattern:
|
||||
data["ErrorMsg"] = trName + l.Tr("form.regex_pattern_error", errs[0].Message)
|
||||
case validation.ErrUsername:
|
||||
data["ErrorMsg"] = trName + l.Tr("form.username_error")
|
||||
if setting.Service.AllowDotsInUsernames {
|
||||
data["ErrorMsg"] = trName + l.Tr("form.username_error")
|
||||
} else {
|
||||
data["ErrorMsg"] = trName + l.Tr("form.username_error_no_dots")
|
||||
}
|
||||
case validation.ErrInvalidGroupTeamMap:
|
||||
data["ErrorMsg"] = trName + l.Tr("form.invalid_group_team_map_error", errs[0].Message)
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue