Beispiel #1
0
        public static void VerifyPasswordReset(PasswordResetVerification request, Action <CertificateReceivedEventArgs> successAction,
                                               Action <ProcessingErrorEventArgs> processingError, Action <string> errorHandler)
        {
            var certificateClient = GetACertificateClient(errorHandler);

            certificateClient.InvalidPasswordResetVerification += (sender, arg) => processingError(arg);
            certificateClient.CertificateReceived += (sender, arg) => successAction(arg);


            TryAsyncCommunication(() => certificateClient.VerifyPasswordReset(request), errorHandler);
        }
Beispiel #2
0
        private void VerifyReset()
        {
            if (!ValidatePassword())
            {
                return;
            }

            var request = new PasswordResetVerification(Password.ToUnsecuredString(), VerificationCode);

            CAServerHelper.VerifyPasswordReset(request, OnCertificateReceived, HandleVerificationProcessingError, ErrorHandler);

            ShowVerificationDialog = false;
            ShowWaitDialog         = true;
        }
Beispiel #3
0
        public void VerifyPasswordReset(object o)
        {
            PasswordResetVerification passwordResetVerification = (PasswordResetVerification)o;

            try
            {
                CertificateClient certificateClient = new CertificateClient();


                Assembly asm = Assembly.GetEntryAssembly();
                certificateClient.ProgramName    = asm.GetName().Name;
                certificateClient.ProgramVersion = AssemblyHelper.GetVersionString(asm);

                certificateClient.CertificateAuthorizationRequired += new EventHandler <EventArgs>(delegate
                {
                    LogMessage(Properties.Resources.Certificate_authorization_required);
                });

                certificateClient.CertificateReceived              += CertificateReceived;
                certificateClient.InvalidEmailVerification         += InvalidEmailVerification;
                certificateClient.InvalidPasswordResetVerification += InvalidPasswordResetVerification;

                certificateClient.ServerErrorOccurred += new EventHandler <ProcessingErrorEventArgs>(delegate
                {
                    LogMessage(Properties.Resources.Server_error_occurred__Please_try_again_later, true);
                });

                certificateClient.NewProtocolVersion += new EventHandler <EventArgs>(delegate
                {
                    LogMessage(Properties.Resources.New_ProtocolVersion__Please_update_CrypTool_2_0, true);
                });

                certificateClient.VerifyPasswordReset(passwordResetVerification);
            }
            catch (NetworkException nex)
            {
                LogMessage(String.Format(Properties.Resources.There_was_a_communication_problem_with_the_server, nex.Message), true);
            }
            catch (Exception ex)
            {
                LogMessage(String.Format(Properties.Resources.An_exception_occured___1, ex.Message), true);
            }
            finally
            {
                Requesting = false;
            }
        }
Beispiel #4
0
        private void VerifyButton_Click(object sender, RoutedEventArgs e)
        {
            this.MessageLabel.Visibility = Visibility.Hidden;
            this.MessageBox.Visibility   = Visibility.Hidden;
            if (string.IsNullOrEmpty(this.ActivationCode.Text))
            {
                LogMessage(Properties.Resources.Activation_code_may_not_be_empty_);
                this.ActivationCode.Focus();
                return;
            }

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

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

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

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

            thread.CurrentCulture   = Thread.CurrentThread.CurrentCulture;
            thread.CurrentUICulture = Thread.CurrentThread.CurrentUICulture;
            PasswordResetVerification passwordResetVerification = new PasswordResetVerification(this.PasswordField.Password, this.ActivationCode.Text);

            thread.Start(passwordResetVerification);
        }