Example #1
0
        private async void AddAccount_Click(object sender, EventArgs e)
        {
            if (textBox5.Text.Any(x => char.IsLetter(x)))
            {
                MessageBox.Show("Zły format tefonu! ");
                return;
            }
            else if (!emailIsValid(textBox2.Text.ToString()) || textBox2.Text.Length == 0)
            {
                MessageBox.Show("Zły format mail! ");
                return;
            }
            else if (textBox3.Text.Length == 0)
            {
                MessageBox.Show("Brak hasła! ");
                return;
            }
            User newUser = new User();

            newUser.Email     = textBox2.Text.ToString();
            newUser.FirstName = textBox1.Text.ToString();
            newUser.LastName  = textBox4.Text.ToString();
            newUser.PassWord  = textBox3.Text.ToString();
            newUser.PhoneNo   = textBox5.Text.ToString();


            UserManagmentUnsecureClient userManagmentUnsecureClient = new UserManagmentUnsecureClient();

            try {
                if (!userManagmentUnsecureClient.IsEmailInDB(newUser.Email))
                {
                    await userManagmentUnsecureClient.AddUserAsync(newUser);
                }
                else
                {
                    MessageBox.Show("Podany mail już istnieje ");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Boom ");
                return;
            }


            RejestrationPanel.Visible = false;
            LoginPanel.Visible        = true;
        }
Example #2
0
        private void AddNewPass_Click(object sender, EventArgs e)
        {
            UserManagmentClient         userManagment = new UserManagmentClient();
            UserManagmentUnsecureClient userManagmentUnsecureClient = new UserManagmentUnsecureClient();

            try
            {
                System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return(true); };
                userManagment.ClientCredentials.UserName.UserName = loginUser;
                userManagment.ClientCredentials.UserName.Password = OldPassBox.Text.ToString();

                userManagment.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode =
                    System.ServiceModel.Security.X509CertificateValidationMode.None;
                userManagment.Login();

                userManagment.ChangePass(loginUser, NewPassBox.Text.ToString());

                UserManagmentClient userManagment2 = new UserManagmentClient();
                userManagment2.ClientCredentials.UserName.UserName = loginUser;
                userManagment2.ClientCredentials.UserName.Password = NewPassBox.Text.ToString();

                userManagment2.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode =
                    System.ServiceModel.Security.X509CertificateValidationMode.None;
                userManagment2.LoginAsync();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Wprowadziłeś złe hasło");
                oldform.log = false;
                return;
            }

            LoginPanel.Visible      = false;
            MyticketsPanel.Location = new Point(240, 188);
            MyticketsPanel.Visible  = true;
            ButtonsPanel.Visible    = true;
            oldform.log             = true;
        }