main: Added API key regex match

This commit is contained in:
Nathan Woodburn 2023-06-10 12:50:23 +10:00
parent 10662f5910
commit 2e6f38d832
Signed by: nathanwoodburn
GPG Key ID: 203B000478AD0EF1

View File

@ -7,6 +7,7 @@ using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml.Linq; using System.Xml.Linq;
@ -287,6 +288,14 @@ namespace FireWallet
} }
if (checkBoxRunHSD.Checked) if (checkBoxRunHSD.Checked)
{ {
if (!Regex.IsMatch(textBoxNodeKey.Text, @"^[a-zA-Z0-9]+$"))
{
NotifyForm notifyForm = new NotifyForm("Please enter valid API key\nDo not use spaces or weird stuff");
notifyForm.ShowDialog();
notifyForm.Dispose();
return;
}
StreamWriter sw = new StreamWriter(dir + "node.txt"); StreamWriter sw = new StreamWriter(dir + "node.txt");
sw.WriteLine("IP: " + textBoxNodeIP.Text); sw.WriteLine("IP: " + textBoxNodeIP.Text);
sw.WriteLine("Network: " + comboBoxNodeNetwork.SelectedIndex); sw.WriteLine("Network: " + comboBoxNodeNetwork.SelectedIndex);