Auth: Add option for case insensitive login (#49262)
* add case insensitive option * treat id as case insensitive * Users: Add integration tests for case insensitive querying * Prefer config struct to global variable * change key to case_insensitive_login * impede conflicting users from logging in * add tests for impeding user retrieval if conflicting * nits and picks Co-authored-by: gamab <gabi.mabs@gmail.com> * Add check in transaction for conflicting user Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> * add update tests * skip on mysql * add custom messages for user admin view Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com> * nit: extra else * linting mistake Co-authored-by: gamab <gabi.mabs@gmail.com> Co-authored-by: Gabriel MABILLE <gamab@users.noreply.github.com>
This commit is contained in:
@@ -360,6 +360,7 @@ type Cfg struct {
|
||||
// User
|
||||
UserInviteMaxLifetime time.Duration
|
||||
HiddenUsers map[string]struct{}
|
||||
CaseInsensitiveLogin bool // Login and Email will be considered case insensitive
|
||||
|
||||
// Annotations
|
||||
AnnotationCleanupJobBatchSize int64
|
||||
@@ -1354,6 +1355,8 @@ func readUserSettings(iniFile *ini.File, cfg *Cfg) error {
|
||||
AutoAssignOrgRole = cfg.AutoAssignOrgRole
|
||||
VerifyEmailEnabled = users.Key("verify_email_enabled").MustBool(false)
|
||||
|
||||
cfg.CaseInsensitiveLogin = users.Key("case_insensitive_login").MustBool(false)
|
||||
|
||||
LoginHint = valueAsString(users, "login_hint", "")
|
||||
PasswordHint = valueAsString(users, "password_hint", "")
|
||||
cfg.DefaultTheme = valueAsString(users, "default_theme", "")
|
||||
|
||||
Reference in New Issue
Block a user