Exemple #1
0
 private void LoginButtonClicked(object sender, RoutedEventArgs e)
 {
     SetFormValidation();
     if (_ruleSet.AllValidationRulesHavePassed())
     {
         try
         {
             LoginUser();
         }
         catch (FaultException <MemoryGameService.Faults.NonExistentUserFault> )
         {
             MessageBox.Show(Properties.Langs.Resources.UserDoesNotExist);
         }
         catch (EndpointNotFoundException)
         {
             MessageBox.Show(Properties.Langs.Resources.ServerConnectionLost);
         }
         catch (TimeoutException)
         {
             MessageBox.Show(Properties.Langs.Resources.ServerTimeoutError);
         }
         catch (CommunicationException)
         {
             MessageBox.Show(Properties.Langs.Resources.CommunicationInterrupted);
         }
     }
     else
     {
         ShowErrorMessage();
     }
 }
Exemple #2
0
 private void RestoreUserPassword()
 {
     _newPassword = NewPasswordBox.Password;
     SetFormValidation();
     if (_ruleSet.AllValidationRulesHavePassed())
     {
         if (TokenIsCorrect())
         {
             if (SetNewPassword())
             {
                 MessageBox.Show(Properties.Langs.Resources.PasswordReset);
                 GoToLogin();
             }
             else
             {
                 MessageBox.Show(Properties.Langs.Resources.PasswordRecoveryError);
             }
         }
         else
         {
             MessageBox.Show(Properties.Langs.Resources.NonMatchingVerificationCode);
         }
     }
     else
     {
         ShowErrorMessage();
     }
 }
 private void SaveChangesButtonClicked(object sender, RoutedEventArgs routedEventArgs)
 {
     _newUsername = TextBoxNewUsername.Text;
     SetFormValidation();
     if (_ruleSet.AllValidationRulesHavePassed())
     {
         try
         {
             SetNewUsername();
         }
         catch (TimeoutException)
         {
             MessageBox.Show(Properties.Langs.Resources.ServerTimeoutError);
         }
         catch (EndpointNotFoundException)
         {
             MessageBox.Show(Properties.Langs.Resources.ServerConnectionLost);
         }
         catch (CommunicationException)
         {
             MessageBox.Show(Properties.Langs.Resources.CommunicationInterrupted);
         }
     }
     else
     {
         ShowErrorMessage();
     }
 }
Exemple #4
0
 private void SendCodeToUser()
 {
     _emailAddress = EmailTextBox.Text;
     SetFormValidation();
     if (_ruleSet.AllValidationRulesHavePassed())
     {
         if (EmailIsRegistered())
         {
             LoadUsername();
             GenerateVerificationToken();
             bool newVerificationTokenWasAssigned = AssignNewRecoveryToken();
             if (newVerificationTokenWasAssigned)
             {
                 SendRecoveryToken();
                 MessageBox.Show(Properties.Langs.Resources.PasswordRecoveryTokenSent);
                 GoToRestorePassword();
             }
             else
             {
                 MessageBox.Show(Properties.Langs.Resources.RecoveryTokenSendingError);
             }
         }
         else
         {
             MessageBox.Show(Properties.Langs.Resources.NonRegisteredEmail);
         }
     }
     else
     {
         ShowErrorMessage();
     }
 }
Exemple #5
0
 private bool AllValidationRulesHavePassed()
 {
     return(_ruleSet.AllValidationRulesHavePassed());
 }