Changeset 2399


Ignore:
Timestamp:
Jan 20, 2011, 6:12:06 PM (10 years ago)
Author:
krueger
Message:

DLLs updated
Changes to make newest version of certificateclient work

override-bad-extension: Bdev.Net.Dns.dll
override-bad-extension: Bootstrapper.dll
override-bad-extension: CertificateLibrary.dll
override-bad-extension: CertServices.dll
override-bad-extension: Chord.dll
override-bad-extension: FullMeshDHT.dll
override-bad-extension: FullMeshOverlay.dll
override-bad-extension: Gears4Net.dll
override-bad-extension: LinkManager.dll
override-bad-extension: log4net.dll
override-bad-extension: PacketDotNet.dll
override-bad-extension: PapsClient.dll
override-bad-extension: PeersAtPlayBase.dll
override-bad-extension: RUDP.dll
override-bad-extension: SharpPcap.dll
override-bad-extension: Stun.dll
override-bad-extension: Util.dll
override-bad-extension: WebDHT.dll

Location:
trunk
Files:
1 added
3 deleted
32 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/P2PEditor/GUI/Controls/ActivateEmailView.xaml.cs

    r2390 r2399  
    4747            Requesting = true;
    4848            Thread thread = new Thread(new ParameterizedThreadStart(ActivateEmail));
    49             object[] array = new object[2];
    50             array[0] = this.ActivationCodeField.Text;
    51             array[1] = this.PasswordField.Password;
    52             thread.Start(array);
     49            EmailVerification emailVer = new EmailVerification(this.PasswordField.Password, this.ActivationCodeField.Text, false);
     50            thread.Start(emailVer);
    5351        }
    5452
    5553        public void ActivateEmail(object o)
    5654        {
    57             object[] array = (object[])o;
    58             string activationCode = (string)array[0];
    59             string password = (string)array[1];
     55            EmailVerification emailVer = (EmailVerification)o;
    6056
    6157            try
    6258            {
    6359                CertificateClient certificateClient = new CertificateClient();
    64                 certificateClient.CertificateAuthorizationDenied += new EventHandler<EventArgs>(delegate
    65                 {
    66                     this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    67                     {
    68                         this.MessageLabel.Content = "Certificate authorization denied";
    69                         this.MessageLabel.Visibility = Visibility.Visible;
    70                     }, null);       
    71                 });
     60                certificateClient.ProgramName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
     61                certificateClient.ProgramVersion = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();
    7262
    7363                certificateClient.CertificateAuthorizationRequired += new EventHandler<EventArgs>(delegate
     
    8070                });
    8171
    82                 certificateClient.CertificateNotYetAuthorized += new EventHandler<EventArgs>(delegate
    83                 {
    84                     this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    85                     {
    86                         this.MessageLabel.Content = "Certificate not yet authorized";
    87                         this.MessageLabel.Visibility = Visibility.Visible;
    88                     }, null);
    89                 });
    90 
    9172                certificateClient.CertificateReceived += CertificateReceived;
    9273
    93                 certificateClient.InvalidCertificateRequest += InvalidCertificateRequest;
    94 
    95                 certificateClient.InvalidEmailCheck += new EventHandler<InvalidRequestEventArgs>(delegate
    96                 {
    97                     this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    98                     {
    99                         this.MessageLabel.Content = "Invalid email address";
    100                         this.MessageLabel.Visibility = Visibility.Visible;
    101                     }, null);
    102                 });
    103 
    104                 certificateClient.ServerErrorOccurred += new EventHandler<EventArgs>(delegate
     74                certificateClient.InvalidEmailVerification += InvalidEmailVerification;
     75
     76                certificateClient.ServerErrorOccurred += new EventHandler<ProcessingErrorEventArgs>(delegate
    10577                {
    10678                    this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
     
    12092                });
    12193
    122                 //todo activate here!!!!
    123                 Thread.Sleep(3000);
     94                certificateClient.VerifyEmail(emailVer);
    12495            }
    12596            catch (NetworkException nex)
     
    145116        }
    146117
    147         public void InvalidCertificateRequest(object sender, InvalidRequestEventArgs args)
     118        public void InvalidEmailVerification(object sender, ProcessingErrorEventArgs args)
    148119        {
    149120            try
    150121            {
    151                 switch (args.ErrorType)
    152                 {
    153                     case RespondType.AvatarAlreadyExists:
    154                         this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    155                         {
    156                             this.MessageLabel.Content = "The username already exists. Please choose another one.";
     122                switch (args.Type)
     123                {
     124                    case ErrorType.NoCertificateFound:
     125                        this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
     126                        {
     127                            this.MessageLabel.Content = "You have entered a wrong verification code.";
    157128                            this.MessageLabel.Visibility = Visibility.Visible;
    158129                        }, null);
    159130                        break;
    160                     case RespondType.EmailAlreadyExists:
    161                         this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    162                         {
    163                             this.MessageLabel.Content = "The email already exists. Please choose another one.";
    164                             this.MessageLabel.Visibility = Visibility.Visible;
    165                         }, null);
    166                         break;
    167                     case RespondType.AvatarEmailAlreadyExists:
    168                         this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    169                         {
    170                             this.MessageLabel.Content = "The username and email already exist but the entered password was wrong.";
     131                    case ErrorType.WrongPassword:
     132                        this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
     133                        {
     134                            this.MessageLabel.Content = "The verification code is ok but the entered password was wrong.";
    171135                            this.MessageLabel.Visibility = Visibility.Visible;
    172136                        }, null);
     
    180144                        this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    181145                        {
    182                             this.MessageLabel.Content = "Invalid certificate request: " + args.ErrorType;
     146                            this.MessageLabel.Content = "Invalid certificate request: " + args.Type;
    183147                            this.MessageLabel.Visibility = Visibility.Visible;
    184148                        }, null);
  • trunk/CrypPlugins/P2PEditor/GUI/Controls/GetNewCertificateView.xaml.cs

    r2390 r2399  
    6868            Requesting = true;
    6969            Thread thread = new Thread(new ParameterizedThreadStart(RetrieveCertificate));
    70             object[] array = new object[3];
    71             array[0] = this.UsernameField.Text;
    72             array[1] = this.EmailField.Text;
    73             array[2] = this.PasswordField.Password;
    74             thread.Start(array);
     70            CertificateRegistration certReg = new CertificateRegistration(this.UsernameField.Text,
     71                                                     this.EmailField.Text,
     72                                                     WorldName,
     73                                                     this.PasswordField.Password);
     74            thread.Start(certReg);
    7575        }
    7676
    7777        public void RetrieveCertificate(object o)
    7878        {
    79             object[] array = (object[])o;
    80             string username = (string)array[0];
    81             string email = (string)array[1];
    82             string password = (string)array[2];
     79            CertificateRegistration certReg = (CertificateRegistration)o;
    8380
    8481            try
    8582            {
    8683                CertificateClient certificateClient = new CertificateClient();
    87                 certificateClient.CertificateAuthorizationDenied += new EventHandler<EventArgs>(delegate
    88                 {
    89                     this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    90                     {
    91                         this.MessageLabel.Content = "Certificate authorization denied";
    92                         this.MessageLabel.Visibility = Visibility.Visible;
    93                     }, null);       
    94                 });
     84                certificateClient.ProgramName = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
     85                certificateClient.ProgramVersion = System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString();
    9586
    9687                certificateClient.CertificateAuthorizationRequired += new EventHandler<EventArgs>(delegate
     
    10091                        this.MessageLabel.Content = "Certificate authorization required";
    10192                        this.MessageLabel.Visibility = Visibility.Visible;
     93                    }, null);
     94                });
     95
     96                certificateClient.EmailVerificationRequired += new EventHandler<EventArgs>(delegate
     97                {
     98                    this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
     99                    {
     100                        this.MessageLabel.Content = "Registration successful. To activate your account, you need to validate your email address. A verification code was sent per email.";
     101                        this.MessageLabel.Visibility = Visibility.Visible;
     102                    }, null);
     103                });
     104
     105                certificateClient.CertificateReceived += CertificateReceived;
     106
     107                certificateClient.InvalidCertificateRegistration += InvalidCertificateRegistration;
     108
     109                certificateClient.ServerErrorOccurred += new EventHandler<ProcessingErrorEventArgs>(delegate
     110                {
     111                    this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
     112                    {
     113                        this.MessageLabel.Content = "Server error occurred. Please try again later";
     114                        this.MessageLabel.Visibility = Visibility.Visible;
     115                    }, null);
     116                });
     117
     118                certificateClient.NewProtocolVersion += new EventHandler<EventArgs>(delegate
     119                {
     120                    this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
     121                    {
     122                        this.MessageLabel.Content = "New ProtocolVersion. Please update CrypTool 2.0";
     123                        this.MessageLabel.Visibility = Visibility.Visible;
    102124                    }, null);
    103125                });
    104126
    105                 certificateClient.CertificateNotYetAuthorized += new EventHandler<EventArgs>(delegate
    106                 {
    107                     this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    108                     {
    109                         this.MessageLabel.Content = "Certificate not yet authorized";
    110                         this.MessageLabel.Visibility = Visibility.Visible;
    111                     }, null);
    112                 });
    113 
    114                 certificateClient.CertificateReceived += CertificateReceived;
    115 
    116                 certificateClient.InvalidCertificateRequest += InvalidCertificateRequest;
    117 
    118                 certificateClient.InvalidEmailCheck += new EventHandler<InvalidRequestEventArgs>(delegate
    119                 {
    120                     this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    121                     {
    122                         this.MessageLabel.Content = "Invalid email address";
    123                         this.MessageLabel.Visibility = Visibility.Visible;
    124                     }, null);
    125                 });
    126 
    127                 certificateClient.ServerErrorOccurred += new EventHandler<EventArgs>(delegate
    128                 {
    129                     this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    130                     {
    131                         this.MessageLabel.Content = "Server error occurred. Please try again later";
    132                         this.MessageLabel.Visibility = Visibility.Visible;
    133                     }, null);
    134                 });
    135 
    136                 certificateClient.NewProtocolVersion += new EventHandler<EventArgs>(delegate
    137                 {
    138                     this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    139                     {
    140                         this.MessageLabel.Content = "New ProtocolVersion. Please update CrypTool 2.0";
    141                         this.MessageLabel.Visibility = Visibility.Visible;
    142                     }, null);
    143                 });
    144 
    145                 certificateClient.RequestCertificate(username,
    146                                                      email,
    147                                                      WorldName,
    148                                                      password);
     127                certificateClient.RegisterCertificate(certReg);
     128
    149129            }
    150130            catch (NetworkException nex)
     
    170150        }
    171151
    172         public void InvalidCertificateRequest(object sender, InvalidRequestEventArgs args)
     152        public void InvalidCertificateRegistration(object sender, ProcessingErrorEventArgs args)
    173153        {
    174154            try
    175155            {
    176                 switch (args.ErrorType)
    177                 {
    178                     case RespondType.AvatarAlreadyExists:
     156                switch (args.Type)
     157                {
     158                    case ErrorType.AvatarAlreadyExists:
    179159                        this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    180160                        {
     
    183163                        }, null);
    184164                        break;
    185                     case RespondType.EmailAlreadyExists:
     165                    case ErrorType.EmailAlreadyExists:
    186166                        this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    187167                        {
     
    190170                        }, null);
    191171                        break;
    192                     case RespondType.AvatarEmailAlreadyExists:
     172                    case ErrorType.WrongPassword:
    193173                        this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    194174                        {
     
    206186                        this.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    207187                        {
    208                             this.MessageLabel.Content = "Invalid certificate request: " + args.ErrorType;
     188                            this.MessageLabel.Content = "Invalid registration: " + args.Type;
    209189                            this.MessageLabel.Visibility = Visibility.Visible;
    210190                        }, null);
Note: See TracChangeset for help on using the changeset viewer.