Пример #1
0
 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;
     }
 }
Пример #2
0
 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);
     }
     // }
 }