示例#1
0
 private void btn_login_Click(object sender, EventArgs e)
 {
     if (tbox_email.TextLength >= 5)
     {
         string email    = tbox_email.Text;
         string password = tbox_password.Text;
         //httpPost validation
         string response = UserDataPostRequest(email, password);
         if (response == "sdsdvsdv")
         {
             ApplicationUser currentUser = new ApplicationUser()
             {
                 Email = email, Password = password
             };
             //Remember me system
             if (cbox_remMe.Checked == true)
             {
                 Properties.Settings.Default.remEmail    = email;
                 Properties.Settings.Default.remPassword = password;
                 Properties.Settings.Default.Save();
             }
             ConnectToRoomForm connectToRoomForm = new ConnectToRoomForm(currentUser);
             connectToRoomForm.Show();
             this.Close();
         }
         else
         {
             throw new Exception();
         }
     }
     else
     {
         tbox_email.Focus();
     }
 }
示例#2
0
 private void btn_register_Click(object sender, EventArgs e)
 {
     if (tbox_email.TextLength >= 5 && tbox_password.TextLength >= 5 && tbox_repeatPasw.TextLength >= 5)
     {
         if (tbox_password.Text == tbox_repeatPasw.Text)
         {
             string email    = tbox_email.Text;
             string password = tbox_password.Text;
             //HttpPost
             string response = UserDataPostRequest(email, password);
             if (response == "sdsdvsdv")
             {
                 ApplicationUser currentUser = new ApplicationUser()
                 {
                     Email = email, Password = password
                 };
                 //Remember me system
                 Properties.Settings.Default.remEmail    = email;
                 Properties.Settings.Default.remPassword = password;
                 Properties.Settings.Default.Save();
                 ConnectToRoomForm connectToRoomForm = new ConnectToRoomForm(currentUser);
                 connectToRoomForm.Show();
                 this.Close();
             }
             else
             {
                 throw new Exception();
             }
         }
         else
         {
             tbox_repeatPasw.Text = string.Empty;
             tbox_repeatPasw.Focus();
         }
     }
     else
     {
         tbox_email.Focus();
     }
 }
示例#3
0
 private void btn_register_Click(object sender, EventArgs e)
 {
     if (tbox_email.TextLength >= 5 && tbox_password.TextLength >= 5 && tbox_repeatPasw.TextLength >= 5)
     {
         if (tbox_password.Text == tbox_repeatPasw.Text)
         {
             string email    = tbox_email.Text;
             string password = tbox_password.Text;
             var    user     = new ApplicationUser()
             {
                 Username = email, Password = password
             };
             if (new HttpHelper().Request(user, ConfigurationManager.AppSettings["ServerHost"] + "api/Auth/Register"))
             {
                 SessionHelper.SetActiveUserSession(user);
                 //Remember me system
                 Properties.Settings.Default.remEmail    = email;
                 Properties.Settings.Default.remPassword = password;
                 Properties.Settings.Default.Save();
                 ConnectToRoomForm connectToRoomForm = new ConnectToRoomForm();
                 connectToRoomForm.Show();
                 this.Close();
             }
             else
             {
                 throw new Exception();
             }
         }
         else
         {
             tbox_repeatPasw.Text = string.Empty;
             tbox_repeatPasw.Focus();
         }
     }
     else
     {
         tbox_email.Focus();
     }
 }