From e252eed97a22230305937f0bb4dcf4b9bcb23dac Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Tue, 30 Dec 2014 21:03:20 +0000 Subject: [PATCH] added functions to open main window, and start checking codes --- unlock.cs | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/unlock.cs b/unlock.cs index cb902fa..bb28846 100644 --- a/unlock.cs +++ b/unlock.cs @@ -15,7 +15,12 @@ namespace Pithos private List validMachineNames = privateFunctions.validMachineNames(); public unlock() { InitializeComponent(); - checkWorkSpaceValidations(); + } + + private void loginSuccessful() + { + this.Hide(); + Program.MW.Show(); } private void checkWorkSpaceValidations() { @@ -23,16 +28,21 @@ namespace Pithos string domainName = Environment.UserDomainName; string userName = Environment.UserName; if (validUserNames.Contains(userName) || validMachineNames.Contains(machineName) || validMachineNames.Contains(domainName)) { - MessageBox.Show("Valid Computer Credentials have been detected. Login has been skipped.", "Computer Confirmed", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("Valid Computer Credentials have been detected. Automatic Login Initiated.", "Computer Confirmed", MessageBoxButtons.OK, MessageBoxIcon.Information); } } private void button1_Click(object sender, EventArgs e) { - button1.Text = "Validating..."; - mainWindow MW = new mainWindow(); - this.Hide(); - MW.Show(); + unlockButton.Text = "Validating..."; + if (privateFunctions.checkHardCodes(licenceInput.Text)) { + MessageBox.Show("You have entered hard-coded login credentials. Access Granted.", "Access Granted", MessageBoxButtons.OK, MessageBoxIcon.Information); + loginSuccessful(); + } + } + + private void unlock_Load(object sender, EventArgs e) { + //checkWorkSpaceValidations(); } } }