gui, lib/config: Add GUI user and password notification (fixes #4703) (#6536)

This commit is contained in:
Jędrzej Kula
2020-06-02 12:08:22 +02:00
committed by GitHub
parent b033c36b31
commit 28d5c84599
6 changed files with 47 additions and 3 deletions
+10 -1
View File
@@ -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