From 50a0ebfc1f35a02310202a38430944d7f5ce4455 Mon Sep 17 00:00:00 2001 From: akuma06 Date: Sun, 7 May 2017 20:21:46 +0200 Subject: [PATCH] Fixed typo --- service/user/form/formValidator.go | 4 ++-- util/modelHelper/modelHelper.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/service/user/form/formValidator.go b/service/user/form/formValidator.go index 2bc05c4c..7a0a5783 100644 --- a/service/user/form/formValidator.go +++ b/service/user/form/formValidator.go @@ -45,9 +45,9 @@ func IsAgreed(t_and_c string) bool { // RegistrationForm is used when creating a user. type RegistrationForm struct { - Username string `form:"username" needed:"true" min_len:"3" max_len:"20"` + Username string `form:"username" needed:"true" len_min:"3" len_max:"20"` Email string `form:"email" needed:"true"` - Password string `form:"password" needed:"true" min_len:"6" max_len:"25"` + Password string `form:"password" needed:"true" len_min:"6" len_max:"25" equalInput:"Confirm_Password"` Confirm_Password string `form:"password_confirmation" omit:"true" needed:"true"` CaptchaID string `form:"captchaID" omit:"true" needed:"true"` T_and_C bool `form:"t_and_c" omit:"true" needed:"true" equal:"true" hum_name:"Terms and Conditions"` diff --git a/util/modelHelper/modelHelper.go b/util/modelHelper/modelHelper.go index 72a98522..785f7de5 100644 --- a/util/modelHelper/modelHelper.go +++ b/util/modelHelper/modelHelper.go @@ -68,19 +68,19 @@ func ValidateForm(form interface{}, errorForm map[string][]string) (map[string][ if tag.Get("len_min") != "" { // Check minimum length lenMin, _ := strconv.Atoi(tag.Get("len_min")) if formElem.Field(i).Len() < lenMin { - errorForm[tag.Get("form")] = append(errorForm[tag.Get("form")], fmt.Sprintf("Minimal length of %s required for the input: %s", lenMin, inputName)) + errorForm[tag.Get("form")] = append(errorForm[tag.Get("form")], fmt.Sprintf("Minimal length of %s required for the input: %s", strconv.Itoa(lenMin), inputName)) } } if tag.Get("len_max") != "" { // Check minimum length lenMax, _ := strconv.Atoi(tag.Get("len_max")) if formElem.Field(i).Len() > lenMax { - errorForm[tag.Get("form")] = append(errorForm[tag.Get("form")], fmt.Sprintf("Maximal length of %s required for the input: %s", lenMax, inputName)) + errorForm[tag.Get("form")] = append(errorForm[tag.Get("form")], fmt.Sprintf("Maximal length of %s required for the input: %s", strconv.Itoa(lenMax), inputName)) } } if tag.Get("equalInput") != "" { - otherInput := formElem.FieldByName(tag.Get("equalForm")) + otherInput := formElem.FieldByName(tag.Get("equalInput")) if formElem.Field(i).Interface() != otherInput.Interface() { - errorForm[tag.Get("form")] = append(errorForm[tag.Get("form")], fmt.Sprintf("Wrong value for the input: %s", inputName)) + errorForm[tag.Get("form")] = append(errorForm[tag.Get("form")], fmt.Sprintf("Must be same %s", inputName)) } } switch typeField.Type.Name() {