Exemplo n.º 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
         if (SessionHelper.SetActiveUserSession(new ApplicationUser {
             Username = email, Password = password
         }))
         {
             if (cbox_remMe.Checked == true)
             {
                 Properties.Settings.Default.remEmail    = email;
                 Properties.Settings.Default.remPassword = password;
                 Properties.Settings.Default.Save();
             }
             ConnectToRoomForm connectToRoomForm = new ConnectToRoomForm();
             this.Hide();
             connectToRoomForm.ShowDialog();
             this.Close();
         }
         else
         {
             throw new Exception();
         }
     }
     else
     {
         tbox_email.Focus();
     }
 }
Exemplo n.º 2
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();
     }
 }
Exemplo n.º 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;
             //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();
     }
 }
Exemplo n.º 4
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();
     }
 }