Exemplo n.º 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();
     }
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 3
0
 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();
     }
 }
Exemplo n.º 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();
     }
 }
Exemplo n.º 5
0
 private bool AllValidationRulesHavePassed()
 {
     return(_ruleSet.AllValidationRulesHavePassed());
 }