private void LogInButton(object sender, RoutedEventArgs e) { // if (User.userNameLoginCheck(this, UserLoginEmail.Text) == true && User.userPasswordLoginCheck(this, UserLoginPassword.Password) == true) // { try { UserSingleton.Create(UserLoginEmail.Text, SHA.sha(UserLoginPassword.Password)); } catch (Exception msg) { MessageBox.Show(msg.ToString()); } //new Server().Login(Email, SHA.sha(Password)); //currentUser.User = user; try { UserSingleton.GetInstance(); this.Close(); } catch (Exception msg) { MessageBox.Show(msg.Message); } // } }
private void Login(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(textBox3.Text) || string.IsNullOrWhiteSpace(UserLoginPassword.Password)) { MessageBox.Show("Error! One or more fields are missing!"); } else if (!userNameLoginCheck(textBox3.Text)) { MessageBox.Show("Error! Wrong email!"); } else if (checkForSQLInjection(UserLoginPassword.Password) || checkForSQLInjection(textBox3.Text)) { MessageBox.Show("Invalid password.\n SQL Injection threat."); } else { try { UserSingleton.Create(textBox3.Text, SHA.sha(UserLoginPassword.Password)); UserSingleton.GetInstance(); this.Close(); } catch (Exception msg) { MessageBox.Show(msg.Message); } //new Server().Login(Email, SHA.sha(Password)); //currentUser.User = user; } }
private void AddUser(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(UserID.Text) || string.IsNullOrEmpty(UserName.Text) || string.IsNullOrEmpty(UserEmail.Text) || string.IsNullOrEmpty(UserPassword.Password)) { MessageBox.Show("Error! One or more fields are missing!"); } else if (!userNameLoginCheck(UserEmail.Text)) { MessageBox.Show("Error! Wrong email!"); } else if (checkForSQLInjection(UserPassword.Password) || checkForSQLInjection(UserName.Text) || checkForSQLInjection(UserEmail.Text)) { MessageBox.Show("Invalid password.\n SQL Injection threat."); } else if (EditUserID != null && !UserID.Text.Equals(EditUserID)) { MessageBox.Show("You can't change user password."); } else { if (EditUserID == null) { result = new Server().AddUser(UserID.Text, UserName.Text, UserEmail.Text, SHA.sha(UserPassword.Password)); } else { result = new Server().EditUser(UserID.Text, UserName.Text, UserEmail.Text, SHA.sha(UserPassword.Password)); } this.Close(); } }