mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-28 20:10:11 +00:00
fix bug where validator was wrongly initialized on settings change
This commit is contained in:
parent
1e6bbc7bbc
commit
b58dfda72f
10
api.go
10
api.go
@ -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 {
|
||||||
|
@ -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); }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user