diff --git a/gui/default/syncthing/core/notifications.html b/gui/default/syncthing/core/notifications.html index 080c3b6a6..28ac9fff3 100644 --- a/gui/default/syncthing/core/notifications.html +++ b/gui/default/syncthing/core/notifications.html @@ -116,3 +116,28 @@ + + + + + GUI Authentication: Set User and Password + + + + Username/Password has not been set for the GUI authentication. Please consider setting it up. + + + If you want to prevent other users on this computer to access Syncthing and through it your files, consider setting up authentication. + + + + + \ No newline at end of file diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index cd3f6e105..5c8b97731 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -448,6 +448,10 @@ angular.module('syncthing.core') && (!guiCfg.user || !guiCfg.password) && guiCfg.authMode !== 'ldap' && !guiCfg.insecureAdminAccess; + + if (guiCfg.user && guiCfg.password) { + dismissNotification('authenticationUserAndPassword'); + } } diff --git a/lib/config/config.go b/lib/config/config.go index 46ff2cbca..23892f392 100644 --- a/lib/config/config.go +++ b/lib/config/config.go @@ -31,7 +31,7 @@ import ( const ( OldestHandledVersion = 10 - CurrentVersion = 30 + CurrentVersion = 31 MaxRescanIntervalS = 365 * 24 * 60 * 60 ) @@ -103,6 +103,8 @@ func New(myID protocol.DeviceID) Configuration { cfg.Version = CurrentVersion cfg.OriginalVersion = CurrentVersion + cfg.Options.UnackedNotificationIDs = []string{"authenticationUserAndPassword"} + util.SetDefaults(&cfg) util.SetDefaults(&cfg.Options) util.SetDefaults(&cfg.GUI) @@ -418,6 +420,13 @@ nextPendingDevice: } if cfg.Options.UnackedNotificationIDs == nil { cfg.Options.UnackedNotificationIDs = []string{} + } else if cfg.GUI.User != "" && cfg.GUI.Password != "" { + for i, key := range cfg.Options.UnackedNotificationIDs { + if key == "authenticationUserAndPassword" { + cfg.Options.UnackedNotificationIDs = append(cfg.Options.UnackedNotificationIDs[:i], cfg.Options.UnackedNotificationIDs[i+1:]...) + break + } + } } return nil diff --git a/lib/config/config_test.go b/lib/config/config_test.go index 9382701aa..6e9d7b788 100644 --- a/lib/config/config_test.go +++ b/lib/config/config_test.go @@ -67,7 +67,7 @@ func TestDefaultValues(t *testing.T) { AlwaysLocalNets: []string{}, OverwriteRemoteDevNames: false, TempIndexMinBlocks: 10, - UnackedNotificationIDs: []string{}, + UnackedNotificationIDs: []string{"authenticationUserAndPassword"}, DefaultFolderPath: "~", SetLowPriority: true, CRURL: "https://crash.syncthing.net/newcrash", diff --git a/lib/config/migrations.go b/lib/config/migrations.go index 53964210e..bc126d12d 100644 --- a/lib/config/migrations.go +++ b/lib/config/migrations.go @@ -25,6 +25,7 @@ import ( // update the config version. The order of migrations doesn't matter here, // put the newest on top for readability. var migrations = migrationSet{ + {31, migrateToConfigV31}, {30, migrateToConfigV30}, {29, migrateToConfigV29}, {28, migrateToConfigV28}, @@ -85,6 +86,11 @@ func (m migration) apply(cfg *Configuration) { cfg.Version = m.targetVersion } +func migrateToConfigV31(cfg *Configuration) { + // Show a notification about setting User and Password + cfg.Options.UnackedNotificationIDs = append(cfg.Options.UnackedNotificationIDs, "authenticationUserAndPassword") +} + func migrateToConfigV30(cfg *Configuration) { // The "max concurrent scans" option is now spelled "max folder concurrency" // to be more general. diff --git a/lib/config/testdata/overridenvalues.xml b/lib/config/testdata/overridenvalues.xml index 9d50b5e7a..159098578 100644 --- a/lib/config/testdata/overridenvalues.xml +++ b/lib/config/testdata/overridenvalues.xml @@ -1,4 +1,4 @@ - + tcp://:23000 false
+ Username/Password has not been set for the GUI authentication. Please consider setting it up. +
+ If you want to prevent other users on this computer to access Syncthing and through it your files, consider setting up authentication. +