aboutsummaryrefslogtreecommitdiff
path: root/internal/ui/form/settings.go
diff options
context:
space:
mode:
authorGravatar Finn <gh@finn.io> 2024-08-12 19:27:08 -0700
committerGravatar GitHub <noreply@github.com> 2024-08-12 19:27:08 -0700
commit770cc1dbb387af580b9ceba1cba9fda69e4444ed (patch)
treec7a4ded9a2cd4ebedd9eda99f85865bf41879d9e /internal/ui/form/settings.go
parent59dac15bdf66a64b5babbc3d87f0f02571730c4d (diff)
downloadv2-770cc1dbb387af580b9ceba1cba9fda69e4444ed.tar.gz
v2-770cc1dbb387af580b9ceba1cba9fda69e4444ed.tar.zst
v2-770cc1dbb387af580b9ceba1cba9fda69e4444ed.zip
feat: Add option to disable local auth form
Diffstat (limited to 'internal/ui/form/settings.go')
-rw-r--r--internal/ui/form/settings.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/internal/ui/form/settings.go b/internal/ui/form/settings.go
index b4ac41cc..8b79ba88 100644
--- a/internal/ui/form/settings.go
+++ b/internal/ui/form/settings.go
@@ -7,6 +7,7 @@ import (
"net/http"
"strconv"
+ "miniflux.app/v2/internal/config"
"miniflux.app/v2/internal/locale"
"miniflux.app/v2/internal/model"
)
@@ -86,7 +87,9 @@ func ExtractMarkAsReadBehavior(behavior MarkReadBehavior) (markReadOnView, markR
// Merge updates the fields of the given user.
func (s *SettingsForm) Merge(user *model.User) *model.User {
- user.Username = s.Username
+ if !config.Opts.DisableLocalAuth() {
+ user.Username = s.Username
+ }
user.Theme = s.Theme
user.Language = s.Language
user.Timezone = s.Timezone
@@ -120,7 +123,7 @@ func (s *SettingsForm) Merge(user *model.User) *model.User {
// Validate makes sure the form values are valid.
func (s *SettingsForm) Validate() *locale.LocalizedError {
- if s.Username == "" || s.Theme == "" || s.Language == "" || s.Timezone == "" || s.EntryDirection == "" || s.DisplayMode == "" || s.DefaultHomePage == "" {
+ if (s.Username == "" && !config.Opts.DisableLocalAuth()) || s.Theme == "" || s.Language == "" || s.Timezone == "" || s.EntryDirection == "" || s.DisplayMode == "" || s.DefaultHomePage == "" {
return locale.NewLocalizedError("error.settings_mandatory_fields")
}