public ActionResult Forgot(PasswordClaim password) { if (ModelState.IsValid) { var claimResponse = new PlatformManagementService.DataAccessResponseType(); var platformManagementServiceClient = new PlatformManagementService.PlatformManagementServiceClient(); try { //Attempt to send lost password claim platformManagementServiceClient.Open(); claimResponse = platformManagementServiceClient.ClaimLostPassword(password.Email, Common.SharedClientKey); //Close the connection WCFManager.CloseConnection(platformManagementServiceClient); } catch (Exception e) { #region Manage Exception string exceptionMessage = e.Message.ToString(); var currentMethod = System.Reflection.MethodBase.GetCurrentMethod(); string currentMethodString = currentMethod.DeclaringType.FullName + "." + currentMethod.Name; // Abort the connection & manage the exception WCFManager.CloseConnection(platformManagementServiceClient, exceptionMessage, currentMethodString); // Upate the response object claimResponse.isSuccess = false; claimResponse.ErrorMessage = WCFManager.UserFriendlyExceptionMessage; //claimresponse.ErrorMessages[0] = exceptionMessage; #endregion } if (claimResponse.isSuccess) { return(RedirectToAction("sent", "password")); } else { //ModelState.AddModelError("", "Invalid username or password."); //foreach (string error in authResponse.ErrorMessages) //{ ModelState.AddModelError("CoreServiceError", claimResponse.ErrorMessage); //} return(View(password)); } } else { return(View(password)); } }
public ActionResult Index(CreateUserFromInvitationModel createUser) { if (ModelState.IsValid) { var response = new PlatformManagementService.DataAccessResponseType(); var platformManagementServiceClient = new PlatformManagementService.PlatformManagementServiceClient(); try { platformManagementServiceClient.Open(); response = platformManagementServiceClient.RegisterInvitedPlatformUser(createUser.Email, createUser.FirstName, createUser.LastName, createUser.Password, createUser.Role, createUser.InvitationCode, Common.SharedClientKey); //Close the connection WCFManager.CloseConnection(platformManagementServiceClient); } catch (Exception e) { #region Manage Exception string exceptionMessage = e.Message.ToString(); var currentMethod = System.Reflection.MethodBase.GetCurrentMethod(); string currentMethodString = currentMethod.DeclaringType.FullName + "." + currentMethod.Name; // Abort the connection & manage the exception WCFManager.CloseConnection(platformManagementServiceClient, exceptionMessage, currentMethodString); // Upate the response object response.isSuccess = false; response.ErrorMessage = WCFManager.UserFriendlyExceptionMessage; //response.ErrorMessages[0] = exceptionMessage; #endregion } if (response.isSuccess) { return(RedirectToAction("Success", "Invitations")); } else { foreach (string error in response.ErrorMessages) { ModelState.AddModelError("Errors", error); } return(View(createUser)); } } else { return(View(createUser)); } }