mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
This commit is contained in:
parent
b033c36b31
commit
28d5c84599
@ -116,3 +116,28 @@
|
||||
</div>
|
||||
</div>
|
||||
</notification>
|
||||
|
||||
<notification id="authenticationUserAndPassword">
|
||||
<div class="panel panel-success">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title"><span class="fas fa-bolt"></span> <span translate>GUI Authentication: Set User and Password</span></h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
<span translate>Username/Password has not been set for the GUI authentication. Please consider setting it up.</span>
|
||||
</p>
|
||||
<p>
|
||||
<span translate>If you want to prevent other users on this computer to access Syncthing and through it your files, consider setting up authentication.</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="panel-footer">
|
||||
<button type="button" class="btn btn-sm btn-default pull-right" ng-click="showSettings()">
|
||||
<span class="fas fa-cog"></span> <span translate>Settings</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-default pull-left" ng-click="dismissNotification('authenticationUserAndPassword')">
|
||||
<span class="fa fa-check-circle"></span> <span translate>OK</span>
|
||||
</button>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
</div>
|
||||
</notification>
|
@ -448,6 +448,10 @@ angular.module('syncthing.core')
|
||||
&& (!guiCfg.user || !guiCfg.password)
|
||||
&& guiCfg.authMode !== 'ldap'
|
||||
&& !guiCfg.insecureAdminAccess;
|
||||
|
||||
if (guiCfg.user && guiCfg.password) {
|
||||
dismissNotification('authenticationUserAndPassword');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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",
|
||||
|
@ -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.
|
||||
|
2
lib/config/testdata/overridenvalues.xml
vendored
2
lib/config/testdata/overridenvalues.xml
vendored
@ -1,4 +1,4 @@
|
||||
<configuration version="29">
|
||||
<configuration version="31">
|
||||
<options>
|
||||
<listenAddress>tcp://:23000</listenAddress>
|
||||
<allowDelete>false</allowDelete>
|
||||
|
Loading…
x
Reference in New Issue
Block a user