diff --git a/.gitignore b/.gitignore index 283dd3a..0e32738 100644 --- a/.gitignore +++ b/.gitignore @@ -241,3 +241,5 @@ ModelManifest.xml # FAKE - F# Make .fake/ /UnitTests/data +/3rd-party/Sia-v1.1.0-windows-amd64/data +/SiaDrive/Config diff --git a/SiaDrive/SiaDrive.htm b/SiaDrive/SiaDrive.htm index 17746ca..79355e9 100644 --- a/SiaDrive/SiaDrive.htm +++ b/SiaDrive/SiaDrive.htm @@ -53,6 +53,13 @@ +
Enter wallet password and click 'Unlock' to continue.
+ + +Please save the following seed. You will need this to unlock and/or restore your wallet. Click 'Done' once you've backed-up your seed.
diff --git a/SiaDrive/SiaDriveDlg.cpp b/SiaDrive/SiaDriveDlg.cpp index ec0fd29..0018fdc 100644 --- a/SiaDrive/SiaDriveDlg.cpp +++ b/SiaDrive/SiaDriveDlg.cpp @@ -12,8 +12,12 @@ #define new DEBUG_NEW #endif -/* Home Test +/* +* Home Test wept saxophone dialect depth update jaunt loincloth asleep lush gnome laptop upper olive itches essential neither feel fewest siblings brunt tasked upwards coal niece faked dating hedgehog magically abort + +* Work Test +lush poverty vary fudge ongoing taboo awakened unnoticed piloted ultimate below bikini inundate afraid itches domestic tender poker awoken vitals opus ammo itself alerts brunt wobbly poetry daft addicted */ // CAboutDlg dialog used for App About @@ -56,6 +60,7 @@ BEGIN_DHTML_EVENT_MAP(CSiaDriveDlg) DHTML_EVENT_ONCLICK(_T("ButtonCancel"), OnButtonCancel) DHTML_EVENT_ONCLICK(_T("CreateWalletButton"), OnButtonCreateWallet) DHTML_EVENT_ONCLICK(_T("ConfirmSeedButton"), OnButtonConfirmSeed) + DHTML_EVENT_ONCLICK(_T("UnlockWalletButton"), OnButtonUnlockWallet) END_DHTML_EVENT_MAP() @@ -75,6 +80,7 @@ void CSiaDriveDlg::DoDataExchange(CDataExchange* pDX) DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceConfirmed"), _walletBalanceConfirmed); DDX_DHtml_ElementInnerText(pDX, _T("WalletBalanceUnconfirmed"), _walletBalanceUnconfirmed); DDX_DHtml_ElementInnerText(pDX, _T("WalletCreatedSeed"), _walletCreatedSeed); + DDX_DHtml_ElementValue(pDX, _T("WalletUnlockPwd"), _unlockWalletPwd); } BEGIN_MESSAGE_MAP(CSiaDriveDlg, CDHtmlDialog) @@ -188,6 +194,26 @@ HRESULT CSiaDriveDlg::OnButtonConfirmSeed(IHTMLElement* /*pElement*/) return S_OK; } +HRESULT CSiaDriveDlg::OnButtonUnlockWallet(IHTMLElement* /*pElement*/) +{ + UpdateData(TRUE); + + if (API_SUCCESS(SiaApiError, _siaApi.GetWallet()->Unlock(_unlockWalletPwd.GetBuffer()))) + { + _unlockWalletPwd = L""; + UpdateData(FALSE); + this->Navigate(this->m_strCurrentUrl); + } + else + { + _unlockWalletPwd = L""; + UpdateData(FALSE); + AfxMessageBox(L"Invalid password entered"); + } + + return S_OK; +} + BOOL CSiaDriveDlg::PreTranslateMessage(MSG* pMsg) { //TODO: Implement copy/paste context menu @@ -221,6 +247,8 @@ void CSiaDriveDlg::OnDocumentComplete(LPDISPATCH, LPCTSTR) _walletBalanceUnconfirmed = L""; _walletBalanceTotal = L""; + SetTimer(IDT_UPDATE, 2000, nullptr); + if ((_connected = UpdateUi(false))) { switch (_siaConfig.GetUI_Main_TabIndex()) @@ -236,8 +264,6 @@ void CSiaDriveDlg::OnDocumentComplete(LPDISPATCH, LPCTSTR) { UpdateData(FALSE); } - - SetTimer(IDT_UPDATE, 2000, nullptr); } void CSiaDriveDlg::OnTimer(UINT_PTR nIDEvent) @@ -255,7 +281,7 @@ void CSiaDriveDlg::OnTimer(UINT_PTR nIDEvent) bool CSiaDriveDlg::DisplaySiaInfo() { _serverVersion = _siaApi.GetServerVersion().c_str(); - if (_serverVersion) + if (_serverVersion.GetLength()) { if (_siaApi.GetWallet()->Refresh()) { @@ -434,7 +460,8 @@ void CSiaDriveDlg::DisplaySeedCreated(const String& seed) void CSiaDriveDlg::DisplayUnlockWallet() { - + KillTimer(IDT_UPDATE); + SetMainWindow(L"unlock_wallet"); } HRESULT CSiaDriveDlg::OnButtonCreateWallet(IHTMLElement* pElement) diff --git a/SiaDrive/SiaDriveDlg.h b/SiaDrive/SiaDriveDlg.h index 7b4b800..be09260 100644 --- a/SiaDrive/SiaDriveDlg.h +++ b/SiaDrive/SiaDriveDlg.h @@ -26,6 +26,7 @@ public: HRESULT OnButtonCancel(IHTMLElement *pElement); HRESULT OnButtonCreateWallet(IHTMLElement* pElement); HRESULT OnButtonConfirmSeed(IHTMLElement* pElement); + HRESULT OnButtonUnlockWallet(IHTMLElement* pElement); // Implementation protected: @@ -62,10 +63,11 @@ private: CSiaApi _siaApi; CString _serverVersion; CString _clientVersion; - CString _walletBalanceTotal; CString _walletBalanceConfirmed; + CString _walletBalanceTotal; CString _walletBalanceUnconfirmed; CString _walletCreatedSeed; + CString _unlockWalletPwd; bool _connected = false; bool _seedCreation = false; static const UINT IDT_UPDATE = 1;