Added nag dialog for first launch asking to set a password on multi-user machines.

This commit is contained in:
Kenneth Skovhede
2017-08-24 13:55:29 +02:00
parent 562500c03f
commit cae0fb7b9e
2 changed files with 40 additions and 5 deletions
+24 -5
View File
@@ -50,8 +50,9 @@ namespace Duplicati.Server.Database
public const string SERVER_SSL_CERTIFICATE = "server-ssl-certificate";
public const string HAS_FIXED_INVALID_BACKUPID = "has-fixed-invalid-backup-id";
public const string UPDATE_CHANNEL = "update-channel";
public const string USAGE_REPORTER_LEVEL = "usage-reporter-level";
}
public const string USAGE_REPORTER_LEVEL = "usage-reporter-level";
public const string HAS_ASKED_FOR_PASSWORD_PROTECTION = "has-asked-for-password-protection";
}
private Dictionary<string, string> m_values;
private Database.Connection m_connection;
@@ -199,9 +200,27 @@ namespace Duplicati.Server.Database
m_values[CONST.IS_FIRST_RUN] = value.ToString();
SaveSettings();
}
}
public bool UnackedError
}
public bool HasAskedForPasswordProtection
{
get
{
var tp = m_values[CONST.HAS_ASKED_FOR_PASSWORD_PROTECTION];
if (string.IsNullOrEmpty(tp))
return true;
return Duplicati.Library.Utility.Utility.ParseBoolOption(m_values, CONST.HAS_ASKED_FOR_PASSWORD_PROTECTION);
}
set
{
lock (m_connection.m_lock)
m_values[CONST.HAS_ASKED_FOR_PASSWORD_PROTECTION] = value.ToString();
SaveSettings();
}
}
public bool UnackedError
{
get
{
@@ -163,5 +163,21 @@ backupApp.controller('AppController', function($scope, $cookies, $location, AppS
var dt = data.data['max-download-speed'];
$scope.throttle_active = (ut != null && ut.trim().length != 0) || (dt != null && dt.trim().length != 0);
var firstpw = data.data['has-asked-for-password-protection'];
var haspw = data.data['server-passphrase'];
if (!firstpw && haspw == '') {
DialogService.dialog(
gettextCatalog.getString('First run setup'),
gettextCatalog.getString('If your machine is in a multi-user environment (i.e. the machine has more than one account), you need to set a password to prevent other users from accessing data on your account.\nDo you want to set a password now?'),
[gettextCatalog.getString('No, my machine has only a single account'), gettextCatalog.getString('Yes')],
function(btn) {
AppService.patch('/serversettings', { 'has-asked-for-password-protection': 'true'}, {'headers': {'Content-Type': 'application/json'}});
if (btn == 1) {
$location.path('/settings');
}
}
);
}
}, AppUtils.connectionError);
});