private void ForgotPassword(object sender, RoutedEventArgs e) { #region Password string EmailPassword = "******"; #endregion #region EmailNonsense string Greeting = ((DateTime.Now.Hour < 12) ? "Good Morning " : (DateTime.Now.Hour < 16 ? "Good Afternoon " : "Good Evening ")); string Name = GetInfo().Split(',')[0]; string Email = GetInfo().Split(',')[1]; Controller.CurrentUser.RecoverPass = ""; List <char> UseableChars = new List <char>(); for (int i = 65; i < 91; i++) { UseableChars.Add((char)i); } for (int i = 48; i < 58; i++) { UseableChars.Add((char)i); } for (int i = 97; i < 122; i++) { UseableChars.Add((char)i); } Random rand = new Random(DateTime.Now.Millisecond); int NewPass = rand.Next(8, 16); for (int i = 0; i < NewPass; i++) { Controller.CurrentUser.RecoverPass += UseableChars[rand.Next(0, UseableChars.Count)]; } #endregion #region MailSection MailMessage Msg = new MailMessage("*****@*****.**", Email); //Sender, Reciever SmtpClient client = new SmtpClient("smtp-mail.outlook.com", 587); //Outlooks host, port client.DeliveryMethod = SmtpDeliveryMethod.Network; //Sent over the network client.UseDefaultCredentials = false; // client.Credentials = new NetworkCredential("*****@*****.**", EmailPassword); //Senders email and pw client.EnableSsl = true; //Ssl needs to be enabled for Outlook Msg.IsBodyHtml = true; //takes html input for body Msg.Subject = ("Account Recovery from Mindful"); //Subject of email //Body of the email Msg.Body = (Greeting + Name + ",\n\n"); Msg.Body += ("<p>We have been notified that you have forgotten your password. In this case we have generated a code for you to use to change your password with.</p><br>"); Msg.Body += ("<b>" + Controller.CurrentUser.RecoverPass + "</b><br><br>"); Msg.Body += ("<p>Thanks for contacting Mindful,<br> Mindful Squad</p>"); try { client.Send(Msg); }//trys and sends it catch//if it fails, notify user { Controller.CurrentUser.errorMessage = "Email could not be sent"; Window Errrrrr = new ErrorWindow(); Errrrrr.ShowDialog(); } #endregion }
private void SubmitApplication(object sender, RoutedEventArgs e) { if (!System.IO.File.Exists(NewPath.Text + "\\" + NewExe.Text)) //If this file that is being added does not exist { Controller.CurrentUser.errorMessage = "This path does not exist."; //Create the error message Window ErrorWindowNew = new ErrorWindow(); //Open a new error window ErrorWindowNew.ShowDialog(); //Display the error window return; //Close the function early } string SaveFileLocation = @"SaveFile.txt"; //Location where the save file is stored string[] Lines = System.IO.File.ReadAllLines(SaveFileLocation); //Retrieve the lines from the text file for (int j = 0; j < Controller.CurrentUser.ExeNames.Count; j++) { if (Controller.CurrentUser.ExeNames[j].ToLower().CompareTo(NewExe.Text.ToLower()) == 0) { goto Finish; } } Controller.CurrentUser.ExeFileLocations.Add(NewPath.Text); //Adds a new file directory Controller.CurrentUser.ExeNames.Add(NewExe.Text); //adds a new file name DisplayListOfExe(); //Updates the listbox Finish: return; }
private void RunApplication(object sender, RoutedEventArgs e) { string FileName = "";//Name of the exe string Location = ""; if (ListOfExe.SelectedItem != null) //Makes sure something is selected { FileName = ListOfExe.SelectedItem.ToString(); //Gets the Exe name of what app you want to run Location = Controller.CurrentUser.ExeFileLocations[ListOfExe.SelectedIndex]; //Gets the location of the file above } if (!System.IO.File.Exists(Location + "\\" + FileName)) //Checks if the file even exists (More just stupid proof of this system) { Controller.CurrentUser.errorMessage = FileName + " could not be opened. File location was not found."; //Change an error message Window errorWindow = new ErrorWindow(); //Create the error window errorWindow.ShowDialog(); //Show the window return; //Close the function early } if (FileName != "") //As long as the file name is not blank { ProcessStartInfo info = new ProcessStartInfo(); //Create a proccess info.FileName = FileName; //Set the apps name here info.WorkingDirectory = Location; //Sets the apps directory here Process.Start(info); //Start the app } }
void UpdatePage() { if (VisualizePage(CurrentPage)) { return; } else //Shouldnt Get here { Controller.CurrentUser.errorMessage = "Page \"" + CurrentPage + "\" does not exist"; Window Errrrrrrrrrrrrrr = new ErrorWindow(); Errrrrrrrrrrrrrr.ShowDialog(); } }
void Submit(object sender, RoutedEventArgs e) { if (CheckForUserNameValitity()) { string SaveFileLocation = @"SaveFile.txt";//Location where the save file is stored List <string> NewUserCreation = new List <string>(); NewUserCreation.Add("#" + UsernameField.Text); NewUserCreation.Add(Controller.CurrentUser.EncryptPW(FirstPWField.Password)); NewUserCreation.Add("@" + FirstNameField.Text + "," + LastNameField.Text); NewUserCreation.Add("$" + DateTime.Now.ToString()); NewUserCreation.Add("&" + Controller.CurrentUser.ProfileImage); NewUserCreation.Add("^" + Theme); NewUserCreation.Add("%" + EmailField.Text); NewUserCreation.Add("[end]"); if (FirstPWField.Password.Length > 8 && FirstPWField.Password == SecondPWField.Password) { if (!IsAlreadyName) { if (FirstNameField.Text.Length > 0 && LastNameField.Text.Length > 0) { if (EmailCheck(EmailField.Text)) { System.IO.File.AppendAllLines(SaveFileLocation, NewUserCreation); this.Close(); return; } } } } Controller.CurrentUser.errorMessage = "Account could not be created. Please edit current proccess and try again."; Window Errrrrrrr = new ErrorWindow(); Errrrrrrr.ShowDialog(); } }