1
0

Prompt for unlock on store password

This commit is contained in:
Scott E. Graves
2017-05-06 13:57:03 -05:00
parent 684c4e244b
commit 1a798cd4cc
5 changed files with 18 additions and 7 deletions

View File

@@ -395,7 +395,7 @@
'RpcPort': getValue('ID_Settings_RpcPort')
}, (success, reason) => {
if (success) {
beginMainApplication(false);
reloadApplication(false);
} else {
displayErrorPopup('Settings Failed', reason);
handleSiaEditSettings();
@@ -635,7 +635,6 @@
function reloadApplication(checkAutoMount) {
document.getElementById('ID_SiaDrive').innerText = 'SiaDrive ' + UiState.clientVersion();
document.getElementById('ID_ServerVersion').innerText = '...';
if (UiState.isOnline()) {
if (UiState.isWalletConfigured()) {
if (UiState.isWalletLocked()) {
@@ -653,6 +652,7 @@
window.addEventListener('load', ()=> {
console.log('Main window load');
document.getElementById('ID_ServerVersion').innerText = '...';
reloadApplication(true);
});
})();

View File

@@ -31,7 +31,7 @@ pushd 3rd_party
)
popd
"%INNO_COMPILER%" /cc SiaDrive_Packager_%MODE%.iss
"%INNO_COMPILER%" /cc SiaDrive_Packager_%MODE%.iss || goto :ERROR
goto :END

View File

@@ -1,5 +1,4 @@
@echo off
pushd "%~dp0%"
call package.cmd Debug
pause
popd

View File

@@ -1,5 +1,4 @@
@echo off
pushd "%~dp0%"
call package.cmd Release
pause
popd

View File

@@ -284,8 +284,12 @@ public:
}
else if (name == "setSiaSettings")
{
auto global = context->GetGlobal();
auto uiState = global->GetValue("uiState");
CefRefPtr<CefV8Value> settings = arguments[0];
CefRefPtr<CefV8Value> cb = arguments[1];
const bool storePwd = _siaDriveConfig->GetStoreUnlockPassword();
_siaDriveConfig->SetLaunchFileMgrOnMount(settings->GetValue("LaunchFileMgrOnMount")->GetBoolValue());
_siaDriveConfig->SetAutoStartOnLogon(settings->GetValue("AutoStartOnLogon")->GetBoolValue());
_siaDriveConfig->SetLaunchBundledSiad(settings->GetValue("LaunchBundledSiad")->GetBoolValue());
@@ -297,12 +301,21 @@ public:
_siaDriveConfig->SetStoreUnlockPassword(settings->GetValue("StoreUnlockPassword")->GetBoolValue());
_siaDriveConfig->SetAutoMountOnUnlock(settings->GetValue("AutoMountOnUnlock")->GetBoolValue());
_siaDriveConfig->SetConfirmApplicationExit(settings->GetValue("ConfirmApplicationExit")->GetBoolValue());
if (!_siaDriveConfig->GetStoreUnlockPassword())
if (!storePwd && _siaDriveConfig->GetStoreUnlockPassword())
{
// Lock to prompt for password
_siaApi.GetWallet()->Lock();
while (_appStarted && !_siaApi.GetWallet()->GetLocked())
{
::Sleep(10);
}
uiState->SetValue("isWalletLocked", CefV8Value::CreateBool(true), V8_PROPERTY_ATTRIBUTE_NONE);
}
else if (!_siaDriveConfig->GetStoreUnlockPassword())
{
SetRegistry("Unlock", "");
}
auto uiState = context->GetGlobal()->GetValue("uiState");
uiState->SetValue("storeUnlockPassword", CefV8Value::CreateBool(_siaDriveConfig->GetStoreUnlockPassword()), V8_PROPERTY_ATTRIBUTE_READONLY);
CefRefPtr<CefProcessMessage> msg = CefProcessMessage::Create("settingsUpdated");