1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-29 12:30:11 +00:00

fix bug where validator was wrongly initialized on settings change

This commit is contained in:
Harvey Tindall 2021-01-04 21:57:23 +00:00
parent 1e6bbc7bbc
commit b58dfda72f
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
2 changed files with 6 additions and 6 deletions

10
api.go
View File

@ -1168,11 +1168,11 @@ func (app *appContext) ModifyConfig(gc *gin.Context) {
if _, ok := req["password_validation"]; ok { if _, ok := req["password_validation"]; ok {
app.debug.Println("Reinitializing validator") app.debug.Println("Reinitializing validator")
validatorConf := ValidatorConf{ validatorConf := ValidatorConf{
"characters": app.config.Section("password_validation").Key("min_length").MustInt(0), "length": app.config.Section("password_validation").Key("min_length").MustInt(0),
"uppercase characters": app.config.Section("password_validation").Key("upper").MustInt(0), "uppercase": app.config.Section("password_validation").Key("upper").MustInt(0),
"lowercase characters": app.config.Section("password_validation").Key("lower").MustInt(0), "lowercase": app.config.Section("password_validation").Key("lower").MustInt(0),
"numbers": app.config.Section("password_validation").Key("number").MustInt(0), "number": app.config.Section("password_validation").Key("number").MustInt(0),
"special characters": app.config.Section("password_validation").Key("special").MustInt(0), "special": app.config.Section("password_validation").Key("special").MustInt(0),
} }
if !app.config.Section("password_validation").Key("enabled").MustBool(false) { if !app.config.Section("password_validation").Key("enabled").MustBool(false) {
for key := range validatorConf { for key := range validatorConf {

View File

@ -173,6 +173,6 @@ if (!window.validationStrings) {
const el = document.getElementById("requirement-" + category); const el = document.getElementById("requirement-" + category);
if (el) { if (el) {
requirements[category] = new Requirement(category, el as HTMLLIElement); requirements[category] = new Requirement(category, el as HTMLLIElement);
} else { console.log(category); } }
} }
} }