aboutsummaryrefslogtreecommitdiff
path: root/internal/ui/form/user.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <f@miniflux.net> 2023-10-21 19:50:29 -0700
committerGravatar Frédéric Guillot <f@miniflux.net> 2023-10-22 13:09:30 -0700
commit14e25ab9fe09b9951b38e56af2bdff7a0737b280 (patch)
tree1e466305ccf868d0253b09895af29f811a3e3393 /internal/ui/form/user.go
parent120aabfbcef4ef453d70861aece3b107b603a911 (diff)
downloadv2-14e25ab9fe09b9951b38e56af2bdff7a0737b280.tar.gz
v2-14e25ab9fe09b9951b38e56af2bdff7a0737b280.tar.zst
v2-14e25ab9fe09b9951b38e56af2bdff7a0737b280.zip
Refactor HTTP Client and LocalizedError packages
Diffstat (limited to 'internal/ui/form/user.go')
-rw-r--r--internal/ui/form/user.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/internal/ui/form/user.go b/internal/ui/form/user.go
index 4c6c4e13..ea4cfcd6 100644
--- a/internal/ui/form/user.go
+++ b/internal/ui/form/user.go
@@ -6,7 +6,7 @@ package form // import "miniflux.app/v2/internal/ui/form"
import (
"net/http"
- "miniflux.app/v2/internal/errors"
+ "miniflux.app/v2/internal/locale"
"miniflux.app/v2/internal/model"
)
@@ -19,31 +19,31 @@ type UserForm struct {
}
// ValidateCreation validates user creation.
-func (u UserForm) ValidateCreation() error {
+func (u UserForm) ValidateCreation() *locale.LocalizedError {
if u.Username == "" || u.Password == "" || u.Confirmation == "" {
- return errors.NewLocalizedError("error.fields_mandatory")
+ return locale.NewLocalizedError("error.fields_mandatory")
}
if u.Password != u.Confirmation {
- return errors.NewLocalizedError("error.different_passwords")
+ return locale.NewLocalizedError("error.different_passwords")
}
return nil
}
// ValidateModification validates user modification.
-func (u UserForm) ValidateModification() error {
+func (u UserForm) ValidateModification() *locale.LocalizedError {
if u.Username == "" {
- return errors.NewLocalizedError("error.user_mandatory_fields")
+ return locale.NewLocalizedError("error.user_mandatory_fields")
}
if u.Password != "" {
if u.Password != u.Confirmation {
- return errors.NewLocalizedError("error.different_passwords")
+ return locale.NewLocalizedError("error.different_passwords")
}
if len(u.Password) < 6 {
- return errors.NewLocalizedError("error.password_min_length")
+ return locale.NewLocalizedError("error.password_min_length")
}
}