예제 #1
0
        private bool ValidateModel()
        {
            if (!Verification.IsValidAvatar(Username))
            {
                ShowMessageBox("Invalid Username");
                return(false);
            }

            if (!Verification.IsValidEmailAddress(Email))
            {
                ShowMessageBox("Invalid Email.");
                return(false);
            }

            if (!Verification.IsValidPassword(Password.ToUnsecuredString()))
            {
                ShowMessageBox("Invalid Password.");
                return(false);
            }

            if (!Password.IsEqualTo(PasswordConfirm))
            {
                ShowMessageBox("Passwords are not equal");
                return(false);
            }

            return(true);
        }
예제 #2
0
        private void ResetPassword()
        {
            var validName  = Verification.IsValidAvatar(Name);
            var validEmail = Verification.IsValidEmailAddress(Email);

            if (!validName && !validEmail)
            {
                ErrorMessage = "Please enter ether a Name or an Email";
                return;
            }

            var request = new PasswordReset();

            if (validName)
            {
                request.Avatar = Name;
            }

            if (validEmail)
            {
                request.Email = Email;
            }

            CAServerHelper.ResetPassword(request, ShowVerification, HandleRequestProcessingError, ErrorHandler);

            ShowInputDialog = false;
            ShowWaitDialog  = true;
        }
예제 #3
0
        private void Request_Click(object sender, RoutedEventArgs e)
        {
            this.MessageLabel.Visibility = Visibility.Hidden;
            this.MessageBox.Visibility   = Visibility.Hidden;
            if (!Verification.IsValidAvatar(this.UsernameField.Text))
            {
                this.LogMessage(Properties.Resources.Username_is_not_valid_);
                this.UsernameField.Focus();
                this.UsernameField.SelectAll();
                return;
            }

            if (!Verification.IsValidEmailAddress(this.EmailField.Text))
            {
                this.LogMessage(Properties.Resources.Email_is_not_valid_);
                this.EmailField.Focus();
                this.EmailField.SelectAll();
                return;
            }

            if (this.PasswordField.Password != this.ConfirmField.Password)
            {
                this.LogMessage(Properties.Resources.Passwords_did_not_match_);
                this.PasswordField.Password = "";
                this.ConfirmField.Password  = "";
                this.PasswordField.Focus();
                return;
            }

            if (!Verification.IsValidPassword(this.PasswordField.Password))
            {
                this.LogMessage(Properties.Resources.Password_is_not_valid_);
                this.PasswordField.Password = "";
                this.ConfirmField.Password  = "";
                this.PasswordField.Focus();
                return;
            }

            Requesting = true;
            Thread thread = new Thread(new ParameterizedThreadStart(RetrieveCertificate));

            thread.CurrentCulture   = Thread.CurrentThread.CurrentCulture;
            thread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
            CertificateRegistration certReg = new CertificateRegistration(this.UsernameField.Text,
                                                                          this.EmailField.Text,
                                                                          WorldName,
                                                                          this.PasswordField.Password);

            thread.Start(certReg);
        }
예제 #4
0
        private void Request_Click(object sender, RoutedEventArgs e)
        {
            if (!Verification.IsValidAvatar(this.UsernameField.Text))
            {
                System.Windows.MessageBox.Show("Username is not valid.", "Username is not valid");
                this.UsernameField.Focus();
                this.UsernameField.SelectAll();
                return;
            }

            if (!Verification.IsValidEmailAddress(this.EmailField.Text))
            {
                System.Windows.MessageBox.Show("Email is not valid.", "Email is not valid");
                this.EmailField.Focus();
                this.EmailField.SelectAll();
                return;
            }

            if (this.PasswordField.Password != this.ConfirmField.Password)
            {
                System.Windows.MessageBox.Show("Passwords did not match", "Passwords did not match");
                this.PasswordField.Password = "";
                this.ConfirmField.Password  = "";
                this.PasswordField.Focus();
                return;
            }

            if (!Verification.IsValidPassword(this.PasswordField.Password))
            {
                System.Windows.MessageBox.Show("Password is not valid.", "Password is not valid");
                this.PasswordField.Password = "";
                this.ConfirmField.Password  = "";
                this.PasswordField.Focus();
                return;
            }

            Requesting = true;
            Thread thread = new Thread(new ParameterizedThreadStart(RetrieveCertificate));

            object[] array = new object[3];
            array[0] = this.UsernameField.Text;
            array[1] = this.EmailField.Text;
            array[2] = this.PasswordField.Password;
            thread.Start(array);
        }
예제 #5
0
        private void Request_Click(object sender, RoutedEventArgs e)
        {
            this.MessageLabel.Visibility = Visibility.Hidden;
            this.MessageBox.Visibility   = Visibility.Hidden;
            if (!Verification.IsValidAvatar(this.UsernameField.Text))
            {
                this.LogMessage(Properties.Resources.Username_is_not_valid_);
                this.UsernameField.Focus();
                this.UsernameField.SelectAll();
                return;
            }


            Requesting = true;
            Thread thread = new Thread(new ParameterizedThreadStart(ResetPassword));

            thread.CurrentCulture   = Thread.CurrentThread.CurrentCulture;
            thread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
            PasswordReset passwordReset = new PasswordReset(this.UsernameField.Text, null);

            thread.Start(passwordReset);
        }