aboutsummaryrefslogtreecommitdiff
path: root/internal/ui/form/settings.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/settings.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/settings.go')
-rw-r--r--internal/ui/form/settings.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/ui/form/settings.go b/internal/ui/form/settings.go
index b640eff7..d5442218 100644
--- a/internal/ui/form/settings.go
+++ b/internal/ui/form/settings.go
@@ -7,7 +7,7 @@ import (
"net/http"
"strconv"
- "miniflux.app/v2/internal/errors"
+ "miniflux.app/v2/internal/locale"
"miniflux.app/v2/internal/model"
)
@@ -64,13 +64,13 @@ func (s *SettingsForm) Merge(user *model.User) *model.User {
}
// Validate makes sure the form values are valid.
-func (s *SettingsForm) Validate() error {
+func (s *SettingsForm) Validate() *locale.LocalizedError {
if s.Username == "" || s.Theme == "" || s.Language == "" || s.Timezone == "" || s.EntryDirection == "" || s.DisplayMode == "" || s.DefaultHomePage == "" {
- return errors.NewLocalizedError("error.settings_mandatory_fields")
+ return locale.NewLocalizedError("error.settings_mandatory_fields")
}
if s.CJKReadingSpeed <= 0 || s.DefaultReadingSpeed <= 0 {
- return errors.NewLocalizedError("error.settings_reading_speed_is_positive")
+ return locale.NewLocalizedError("error.settings_reading_speed_is_positive")
}
if s.Confirmation == "" {
@@ -80,7 +80,7 @@ func (s *SettingsForm) Validate() error {
s.Password = ""
} else if s.Password != "" {
if s.Password != s.Confirmation {
- return errors.NewLocalizedError("error.different_passwords")
+ return locale.NewLocalizedError("error.different_passwords")
}
}