private async void NextButton_Click(object sender, RoutedEventArgs e) { if ((ValidUsername == true) && (ValidEmail == true) && (ValidPhone == true) && (ValidPassword == true) && (ValidMasterPassword == true)) { string salt = CryptoClass.GetRandomNumber(); //Отправка Email string EmailCode = CryptoClass.GetRandomNumber(); DatabaseLogicClass.SQLiteExecute("INSERT INTO codes(code_source,code) VALUES ('" + CryptoClass.MD5Hash(EmalTextBox.Text + salt) + "','" + CryptoClass.MD5Hash(EmailCode) + "')"); await EmailSenderClass.SendEmailAsync("Ваш код для подтверждения e-mail: " + EmailCode, EmalTextBox.Text); //MessageBox.Show("Email code: " + EmailCode); //Отпрвка SMS string SMSCode = CryptoClass.GetRandomNumber(); DatabaseLogicClass.SQLiteExecute("INSERT INTO codes(code_source,code) VALUES ('" + CryptoClass.MD5Hash(PhoneTextBox.Text + salt) + "','" + CryptoClass.MD5Hash(SMSCode) + "')"); SMSSenderClass ConfirmSMS_obj = new SMSSenderClass(); string[] numbers = new string[] { PhoneTextBox.Text }; var request = new Request { numbers = numbers, text = SMSCode, channel = "DIRECT" }; ConfirmSMS_obj.sms_send(request); //MessageBox.Show("Тук тук халявная SMS: "+SMSCode); ConfirmAllWindow ConfirmWindow_obj = new ConfirmAllWindow(EmalTextBox.Text, PhoneTextBox.Text, CryptoClass.MD5Hash(PasswordBox.Password), salt, UsernameTextBox.Text); ConfirmWindow_obj.Show(); Close(); } }
private async void PhoneConfirmButton_Click(object sender, RoutedEventArgs e) { if ((OldPhoneValidation == true) && (NewPhoneValidation = true)) { string salt = CryptoClass.GetRandomNumber(); string SMSCode = CryptoClass.GetRandomNumber(); DatabaseLogicClass.SQLiteExecute("INSERT INTO codes(code_source,code) VALUES ('" + CryptoClass.MD5Hash(NewPhoneTextBox.Text + salt) + "','" + CryptoClass.MD5Hash(SMSCode) + "')"); SMSSenderClass ConfirmSMS_obj = new SMSSenderClass(); string[] numbers = new string[] { NewPhoneTextBox.Text }; var request = new Request { numbers = numbers, text = SMSCode, channel = "DIRECT" }; ConfirmSMS_obj.sms_send(request); DEMKAInputBox SMSdemka_obj = new DEMKAInputBox("Ввведите код, отправленный на новый номер телефона:"); string InputCode = SMSdemka_obj.ShowDialog(); if (InputCode == SMSCode) { await DatabaseLogicClass.MySQLExecuteAsync("UPDATE Users SET Phone = '" + CryptoClass.MD5Hash(NewPhoneTextBox.Text) + "' WHERE Phone='" + CryptoClass.MD5Hash(OldPhoneTextBox.Text) + "' "); MessageBox.Show("Успешно обновили номер телефона с " + OldPhoneTextBox.Text + " на " + NewPhoneTextBox.Text); } else { MessageBox.Show("Код подтвержения '" + InputCode + "' не является действительным"); } Close(); } }
private void EnterButton_Click(object sender, RoutedEventArgs e) { if ((LoginTextBox.Text != "") && (PasswordBox.Password != "")) { string CheckPhoneLoginString = CheckPhoneLogin(LoginTextBox.Text, PasswordBox.Password, ThisAutoLoginEnabled); string CheckEmailLoginString = CheckEmailLogin(LoginTextBox.Text, PasswordBox.Password, ThisAutoLoginEnabled); if ((CheckPhoneLoginString != "") || (CheckEmailLoginString != "")) { DatabaseLogicClass.SQLiteExecute("UPDATE logins SET authenticated = 0"); DatabaseLogicClass.SQLiteExecute("INSERT INTO logins(login,authenticated) VALUES ('" + CryptoClass.MD5Hash(LoginTextBox.Text) + "',1)"); string outnamestr = (CheckPhoneLoginString != "") ? CheckPhoneLoginString : CheckEmailLoginString; SenderWindow SenderWindow_obj = new SenderWindow(TG_obj, TelegramEnabled, outnamestr); if ((SaveLoginCheckBox.IsChecked == true) && (ThisAutoLoginEnabled == false)) { DatabaseLogicClass.SQLiteExecute("UPDATE savedlogin SET savedbool = 1, login = '******', pass = '******' WHERE id = 1"); } else if (SaveLoginCheckBox.IsChecked == false) { DatabaseLogicClass.SQLiteExecute("UPDATE savedlogin SET savedbool = 0, login = '******', pass = '******' WHERE id = 1"); } MessageBox.Show("Успешная авторизация"); SenderWindow_obj.Show(); Close(); } else { MessageBox.Show("Ошибка аутентификации"); DatabaseLogicClass.SQLiteExecute("UPDATE savedlogin SET savedbool = 0, login = '******', pass = '******' WHERE id = 1"); ThisAutoLoginEnabled = false; LoginTextBox.Text = ""; PasswordBox.Password = ""; } } else { MessageBox.Show("Введите логин пользователя и пароль"); } }
private void TelegramServerLabel_MouseLeftButtonUp(object sender, RoutedEventArgs e) { if (DatabaseLogicClass.SQLiteGet("SELECT boolvalue FROM servicetable WHERE service='TelegramService'") == "1") { DatabaseLogicClass.SQLiteExecute("UPDATE servicetable SET boolvalue = 0 WHERE service='TelegramService'"); TelegramServerLabel.Content = "Сервер Telegram: выключен"; TG_obj.TelegramInit(2, true); } else { DatabaseLogicClass.SQLiteExecute("UPDATE servicetable SET boolvalue = 1 WHERE service='TelegramService'"); TelegramServerLabel.Content = "Сервер Telegram: включен"; if (TG_obj == null) { TG_obj = new TelegramClass(); TG_obj.TelegramInit(1, true); } TG_obj.TelegramInit(3, true); } }
private void ExitButton_Click(object sender, RoutedEventArgs e) { DatabaseLogicClass.SQLiteExecute("UPDATE savedlogin SET savedbool = 0, login = '******', pass = '******' WHERE id = 1"); Close(); }