public void LoginHandler(object sender, RoutedEventArgs e) { //This secures the account intead of creating a plain text file //This will create a file such as ‘.ȲÎIä¥AIZµp if the imput was asdf string User = Username.WaterTextbox.Text; string Pass = Password.WaterTextbox.Password; byte[] UserHash = Security.Encrypt(System.Text.Encoding.ASCII.GetBytes(User)); byte[] PassHash = Security.Encrypt(System.Text.Encoding.ASCII.GetBytes(Pass)); Login.CreateLoginFile(UserHash, System.IO.Path.Combine(Client.ExecutingDirectory, "Login"), "LegacyLoginUser.Encrypted"); Login.CreateLoginFile(PassHash, System.IO.Path.Combine(Client.ExecutingDirectory, "Login"), "LegacyLoginPass.Encrypted"); Client.Username = User; Client.Password = Pass; PageLogic.SwichMaserPage <SelectAccountPage>(); }
public void LoginHandler(object sender, RoutedEventArgs e) { string User = Username.WaterTextbox.Text; string Pass = Password.WaterTextbox.Password; byte[] UserHash = Security.Encrypt(System.Text.Encoding.ASCII.GetBytes(User)); byte[] PassHash = Security.Encrypt(System.Text.Encoding.ASCII.GetBytes(Pass)); Login.CreateLoginFile(UserHash, System.IO.Path.Combine(Client.ExecutingDirectory, "Login"), "LegacyLoginUser.Temp.Encrypted"); Login.CreateLoginFile(PassHash, System.IO.Path.Combine(Client.ExecutingDirectory, "Login"), "LegacyLoginPass.Temp.Encrypted"); string UserFile = System.IO.File.ReadAllText(System.IO.Path.Combine(Client.ExecutingDirectory, "Login", "LegacyLoginUser.Encrypted")); string PassFile = System.IO.File.ReadAllText(System.IO.Path.Combine(Client.ExecutingDirectory, "Login", "LegacyLoginPass.Encrypted")); string UserTempFile = System.IO.File.ReadAllText(System.IO.Path.Combine(Client.ExecutingDirectory, "Login", "LegacyLoginUser.Temp.Encrypted")); string PassTempFile = System.IO.File.ReadAllText(System.IO.Path.Combine(Client.ExecutingDirectory, "Login", "LegacyLoginPass.Temp.Encrypted")); if (UserFile == UserTempFile) { if (PassFile == PassTempFile) { Client.Username = User; Client.Password = Pass; PageLogic.SwichMaserPage <SelectAccountPage>(); } else { Username.WaterTextbox.Text = ""; Password.WaterTextbox.Password = ""; HintLabel.Content = "Your Username or Password Is Incorrect"; } } else { Username.WaterTextbox.Text = ""; Password.WaterTextbox.Password = ""; HintLabel.Content = "Your Username or Password Is Incorrect"; } System.IO.File.Delete(System.IO.Path.Combine(Client.ExecutingDirectory, "Login", "LegacyLoginUser.Temp.Encrypted")); System.IO.File.Delete(System.IO.Path.Combine(Client.ExecutingDirectory, "Login", "LegacyLoginPass.Temp.Encrypted")); }
private void DeleteAccounts(object sender, RoutedEventArgs e) { System.IO.Directory.Delete(System.IO.Path.Combine(Client.ExecutingDirectory, "Login"), true); PageLogic.HideOverlay(new Thickness(2000, 0, -2000, 0)); PageLogic.SwichMaserPage <CreateAccountPage>(); }