func (rcv *account) Validate(r *http.Request, errs binding.Errors) binding.Errors { if rcv.NewPw == "" || rcv.ConfirmPw == "" { errs = append(errs, binding.Error{ FieldNames: []string{"Password"}, Classification: "PasswordError", Message: rcv.Translate("text18"), }) } else if err := maccount.ValidatePassword(rcv.NewPw, rcv.Local); err != nil { errs = append(errs, binding.Error{ FieldNames: []string{"Password"}, Classification: "PasswordError", Message: err.Error(), }) } else if rcv.NewPw != rcv.ConfirmPw { errs = append(errs, binding.Error{ FieldNames: []string{"Password"}, Classification: "PasswordError", Message: rcv.Translate("text17"), }) } return errs }
func (rcv *account) Validate(r *http.Request, errs binding.Errors) binding.Errors { if rcv.Name == "" { errs = append(errs, binding.Error{ FieldNames: []string{"Name"}, Classification: "EmptyError", Message: rcv.Translate("text01"), }) } else if err := maccount.ValidateName(rcv.Name, rcv.Local); err != nil { errs = append(errs, binding.Error{ FieldNames: []string{"Name"}, Classification: "NameError", Message: err.Error(), }) } if rcv.Email == "" { errs = append(errs, binding.Error{ FieldNames: []string{"Email"}, Classification: "EmptyError", Message: rcv.Translate("text02"), }) } else if err := maccount.ValidateEmail(rcv.Email, rcv.Local); err != nil { errs = append(errs, binding.Error{ FieldNames: []string{"Email"}, Classification: "EmailError", Message: err.Error(), }) } if rcv.Emailconfirm == "" { errs = append(errs, binding.Error{ FieldNames: []string{"Emailconfirm"}, Classification: "EmptyError", Message: rcv.Translate("text03"), }) } else if rcv.Emailconfirm != rcv.Email { errs = append(errs, binding.Error{ FieldNames: []string{"Email equality"}, Classification: "NotEqualError", Message: rcv.Translate("text07"), }) } if rcv.Password == "" { errs = append(errs, binding.Error{ FieldNames: []string{"Password"}, Classification: "EmptyError", Message: rcv.Translate("text04"), }) } else if err := maccount.ValidatePassword(rcv.Password, rcv.Local); err != nil { errs = append(errs, binding.Error{ FieldNames: []string{"Password"}, Classification: "PasswordError", Message: err.Error(), }) } if rcv.TermOf == false { errs = append(errs, binding.Error{ FieldNames: []string{"Emailconfirm"}, Classification: "EmptyError", Message: rcv.Translate("text06"), }) } return errs }