From b58dfda72f269a8d6d1c21873045bfa3a8825fe2 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Mon, 4 Jan 2021 21:57:23 +0000 Subject: [PATCH] fix bug where validator was wrongly initialized on settings change --- api.go | 10 +++++----- ts/form.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/api.go b/api.go index c70d2f7..9c46b78 100644 --- a/api.go +++ b/api.go @@ -1168,11 +1168,11 @@ func (app *appContext) ModifyConfig(gc *gin.Context) { if _, ok := req["password_validation"]; ok { app.debug.Println("Reinitializing validator") validatorConf := ValidatorConf{ - "characters": app.config.Section("password_validation").Key("min_length").MustInt(0), - "uppercase characters": app.config.Section("password_validation").Key("upper").MustInt(0), - "lowercase characters": app.config.Section("password_validation").Key("lower").MustInt(0), - "numbers": app.config.Section("password_validation").Key("number").MustInt(0), - "special characters": app.config.Section("password_validation").Key("special").MustInt(0), + "length": app.config.Section("password_validation").Key("min_length").MustInt(0), + "uppercase": app.config.Section("password_validation").Key("upper").MustInt(0), + "lowercase": app.config.Section("password_validation").Key("lower").MustInt(0), + "number": app.config.Section("password_validation").Key("number").MustInt(0), + "special": app.config.Section("password_validation").Key("special").MustInt(0), } if !app.config.Section("password_validation").Key("enabled").MustBool(false) { for key := range validatorConf { diff --git a/ts/form.ts b/ts/form.ts index 0cfb596..714bee7 100644 --- a/ts/form.ts +++ b/ts/form.ts @@ -173,6 +173,6 @@ if (!window.validationStrings) { const el = document.getElementById("requirement-" + category); if (el) { requirements[category] = new Requirement(category, el as HTMLLIElement); - } else { console.log(category); } + } } }