From a19833d025bfc6b55aac8a3e129f1861c8b03d5f Mon Sep 17 00:00:00 2001 From: Nathan Woodburn Date: Wed, 5 Jul 2023 18:21:11 +1000 Subject: [PATCH] main: Cleaned login panel --- FireWalletLite/Loader.Designer.cs | 5 ++++- FireWalletLite/Loader.cs | 13 +------------ FireWalletLite/MainForm.Designer.cs | 4 ++-- FireWalletLite/MainForm.cs | 17 ++++++++++------- 4 files changed, 17 insertions(+), 22 deletions(-) diff --git a/FireWalletLite/Loader.Designer.cs b/FireWalletLite/Loader.Designer.cs index 5dee596..daba024 100644 --- a/FireWalletLite/Loader.Designer.cs +++ b/FireWalletLite/Loader.Designer.cs @@ -42,7 +42,10 @@ MinimizeBox = false; Name = "Loader"; Text = "Loader"; - Load += Loader_Load; + Visible = false; + Opacity = 0; + FormBorderStyle = FormBorderStyle.SizableToolWindow; + ShowInTaskbar = false; ResumeLayout(false); } diff --git a/FireWalletLite/Loader.cs b/FireWalletLite/Loader.cs index f5f06e5..0b47ab9 100644 --- a/FireWalletLite/Loader.cs +++ b/FireWalletLite/Loader.cs @@ -39,11 +39,7 @@ namespace FireWalletLite string repositoryUrl = "https://github.com/handshake-org/hsd.git"; string destinationPath = dir + "hsd"; CloneRepository(repositoryUrl, destinationPath); - } - - - // Start HSD HSDProcess.StartInfo.RedirectStandardInput = true; HSDProcess.StartInfo.RedirectStandardOutput = false; @@ -70,15 +66,8 @@ namespace FireWalletLite Application.DoEvents(); } splashScreen.Dispose(); + mainForm.Show(); } - - private void Loader_Load(object sender, EventArgs e) - { - this.ShowInTaskbar = false; - this.Opacity = 0; - } - - #region Git public void CloneRepository(string repositoryUrl, string destinationPath) { diff --git a/FireWalletLite/MainForm.Designer.cs b/FireWalletLite/MainForm.Designer.cs index 3423742..5d7ce38 100644 --- a/FireWalletLite/MainForm.Designer.cs +++ b/FireWalletLite/MainForm.Designer.cs @@ -71,8 +71,7 @@ panelLogin.Controls.Add(textBoxPassword); panelLogin.Controls.Add(labelPassword); panelLogin.Controls.Add(LoginButton); - panelLogin.Dock = DockStyle.Fill; - panelLogin.Location = new Point(0, 22); + panelLogin.Location = new Point(776, 443); panelLogin.Name = "panelLogin"; panelLogin.Size = new Size(784, 428); panelLogin.TabIndex = 1; @@ -95,6 +94,7 @@ textBoxPassword.Size = new Size(137, 29); textBoxPassword.TabIndex = 2; textBoxPassword.UseSystemPasswordChar = true; + textBoxPassword.KeyDown += textBoxPassword_KeyDown; // // labelPassword // diff --git a/FireWalletLite/MainForm.cs b/FireWalletLite/MainForm.cs index 46c6a48..5963518 100644 --- a/FireWalletLite/MainForm.cs +++ b/FireWalletLite/MainForm.cs @@ -206,8 +206,6 @@ namespace FireWalletLite //req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes("x:" + key))); req.Content = new StringContent(content); // Send request - - try { HttpResponseMessage resp = await httpClient.SendAsync(req); @@ -237,7 +235,6 @@ namespace FireWalletLite string port = "1203"; if (wallet) port = port + "9"; else port = port + "7"; - try { HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://" + ip + ":" + port + "/" + path); @@ -266,7 +263,6 @@ namespace FireWalletLite } } #endregion - private void MainForm_Load(object sender, EventArgs e) { LoginButton.Left = (this.ClientSize.Width - LoginButton.Width) / 2; @@ -292,7 +288,6 @@ namespace FireWalletLite firstLoginForm.Dispose(); } } - private async void Login_Click(object sender, EventArgs e) { LoginButton.Enabled = false; // To prevent double clicking @@ -302,17 +297,17 @@ namespace FireWalletLite string content = "{\"passphrase\": \"" + Password + "\",\"timeout\": 60}"; string response = await APIPost(path, true, content); - if (response.Contains("Could not decrypt")) + if (response == "Error") { Password = ""; NotifyForm notifyForm = new NotifyForm("Incorrect Password"); notifyForm.ShowDialog(); notifyForm.Dispose(); LoginButton.Enabled = true; + return; } panelLogin.Hide(); } - private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { // Run taskkill /im "node.exe" /f /t @@ -322,7 +317,15 @@ namespace FireWalletLite startInfo.CreateNoWindow = true; Process.Start(startInfo); Environment.Exit(0); + } + private void textBoxPassword_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyValue == 13) + { + Login_Click(sender, e); + e.SuppressKeyPress = true; + } } } }