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 Forgot() { var passwordClaim = new PasswordClaim(); //Get the subdomain (if exists) for the site string subdomain = Common.GetSubDomain(Request.Url); if (!String.IsNullOrEmpty(subdomain)) { //If subdomain exists, add the subdomain to the login object, otherwise View will ask user to manually enter it: passwordClaim.AccountNameKey = subdomain; return(View(passwordClaim)); } else { return(Content("No account specified.")); } }
public ActionResult Forgot() { var resetPassword = new PasswordClaim(); return(View(resetPassword)); }