/// <summary> /// Validate Login Credentials /// </summary> /// <returns>True/False</returns> private bool CredentialValidation() { bool credentialValidation = MissingValidations(); try { if (_manageLogins != null) { if (credentialValidation) { #region GetUser Service Call _manageLogins.GetUser(LoginIdText, false, (user) => { string methodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); Logging.LogLoginBeginMethod(_logger, methodNamespace, LoginIdText); try { if (user != null) { Logging.LogLoginMethodParameter(_logger, methodNamespace, user, 1, LoginIdText); #region GetRolesForUser Service Call _manageLogins.GetRolesForUser(user.UserName, (userRoles) => { string userRolesMethodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); Logging.LogLoginBeginMethod(_logger, userRolesMethodNamespace, LoginIdText); try { if (userRoles != null) { Logging.LogLoginMethodParameter(_logger, userRolesMethodNamespace, userRoles, 1, _loginIdText); UserRoles = userRoles; #region ValidateUser Service Call _manageLogins.ValidateUser(LoginIdText, PasswordText, (result) => { string userValidationmethodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); Logging.LogLoginBeginMethod(_logger, userValidationmethodNamespace, LoginIdText); try { if (result != null) { Logging.LogLoginMethodParameter(_logger, userValidationmethodNamespace, result, 1, _loginIdText); if ((bool)result) { LoadModule(); } else { if (!user.IsApproved) { Logging.LogAccountInactiveLoginAttempt(_logger, LoginIdText); LoginIdState = FieldState.LoginUnapproved; PasswordState = FieldState.LoginUnapproved; } else if (user.IsLockedOut) { Logging.LogAccountLockedLoginAttempt(_logger, LoginIdText); LoginIdState = FieldState.LoginLocked; PasswordState = FieldState.LoginLocked; } else { Logging.LogAccountInvalidLoginAttempt(_logger, LoginIdText); LoginIdState = FieldState.InvalidField; PasswordState = FieldState.InvalidField; } } } else { Logging.LogLoginMethodParameterNull(_logger, userValidationmethodNamespace, 1, LoginIdText); LoginIdState = FieldState.InvalidField; PasswordState = FieldState.InvalidField; } } catch (Exception ex) { Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); Logging.LogLoginException(_logger, ex); } Logging.LogLoginEndMethod(_logger, userValidationmethodNamespace, LoginIdText); }); #endregion } else { Logging.LogLoginMethodParameterNull(_logger, userRolesMethodNamespace, 1, LoginIdText); } } catch (Exception ex) { Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); Logging.LogLoginException(_logger, ex); } Logging.LogLoginEndMethod(_logger, userRolesMethodNamespace, LoginIdText); }); #endregion } else { Logging.LogLoginMethodParameterNull(_logger, methodNamespace, 1, LoginIdText); LoginIdState = FieldState.InvalidField; PasswordState = FieldState.InvalidField; } } catch (Exception ex) { Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); Logging.LogLoginException(_logger, ex); } Logging.LogLoginEndMethod(_logger, methodNamespace, LoginIdText); }); #endregion } } } catch (Exception ex) { Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); Logging.LogLoginException(_logger, ex); } credentialValidation = LoginIdState == FieldState.ValidField && PasswordState == FieldState.ValidField; return(credentialValidation); }
/// <summary> /// Update button click event or Login ID/Password/NewPassword/ConfPassword Enter Press event implementation - validate errors, navigate to notification screen /// </summary> /// <param name="param"></param> private void UpdateCommandMethod(object param) { try { if (_manageLogins != null) { if (ErrorValidation()) { #region ValidateUser Service Call _manageLogins.ValidateUser(LoginIdText, PasswordText, (credentialValidation) => { string methodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); Logging.LogLoginBeginMethod(_logger, methodNamespace, LoginIdText); if (credentialValidation != null) { try { if ((bool)credentialValidation) { Logging.LogLoginMethodParameter(_logger, methodNamespace, credentialValidation, 1, _loginIdText); #region ChangePassword Service Call _manageLogins.ChangePassword(LoginIdText, PasswordText, NewPasswordText, (resetValidation) => { string changeMethodNamespace = String.Format("{0}.{1}", GetType().FullName, System.Reflection.MethodInfo.GetCurrentMethod().Name); Logging.LogLoginBeginMethod(_logger, changeMethodNamespace, LoginIdText); try { if (resetValidation != null) { Logging.LogLoginMethodParameter(_logger, changeMethodNamespace, resetValidation, 1, _loginIdText); if ((bool)resetValidation) { Logging.LogAccountPasswordChange(_logger, LoginIdText); ResourceManager NotificationManager = new ResourceManager(typeof(Notifications)); NotificationText = NotificationManager.GetString("PasswordChangeNotification").Replace("[LoginID]", LoginIdText); _regionManager.RequestNavigate(RegionNames.MAIN_REGION, new Uri("ViewNotifications", UriKind.Relative)); } else { Logging.LogLoginMethodParameterNull(_logger, changeMethodNamespace, 1, LoginIdText); ResetErrorPopupIsOpen = true; } } else { Logging.LogMethodParameterNull(_logger, changeMethodNamespace, 1); } } catch (Exception ex) { Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); Logging.LogLoginException(_logger, ex); } Logging.LogLoginEndMethod(_logger, changeMethodNamespace, LoginIdText); }); #endregion } else { Logging.LogLoginMethodParameterNull(_logger, methodNamespace, 1, LoginIdText); LoginIdState = FieldState.InvalidField; PasswordState = FieldState.InvalidField; } } catch (Exception ex) { Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); Logging.LogLoginException(_logger, ex); } } else { Logging.LogLoginMethodParameterNull(_logger, methodNamespace, 1, LoginIdText); } Logging.LogLoginEndMethod(_logger, methodNamespace, LoginIdText); }); #endregion } } } catch (Exception ex) { Prompt.ShowDialog("Message: " + ex.Message + "\nStackTrace: " + Logging.StackTraceToString(ex), "Exception", MessageBoxButton.OK); Logging.LogLoginException(_logger, ex); } }