using System.Web.Mvc; using System.Web.UI; using Pilotfish.Afx.Security; namespace Pilotfish.Afx.Test.WebConsole.Controllers.Auth { public partial class AuthController { [OutputCache(Location = OutputCacheLocation.None)] public ActionResult ForgotPassword() { ViewBag.Controller = "Authentication"; return View(); } #region JSON endpoints // All JSON endpoints require [HttpPost] to prevent JSON hijacking. // With [HttpPost], returning arrays is allowed. // See http://haacked.com/archive/2009/06/25/json-hijacking.aspx #region GetResetQuestion // POST: /Home/GetResetQuestion [HttpPost] public JsonResult GetResetQuestion(string userName) { var question = DomainAuthenticationProvider.GetResetQuestion(userName); return Json(new { success = !string.IsNullOrEmpty(question), question }); } #endregion #region ResetPassword // POST: /Home/ResetPassword [HttpPost] public JsonResult ResetPassword(string userName, string question, string answer) { var success = DomainAuthenticationProvider.ResetPassword(userName, question, answer); return Json(new { success }); } #endregion #endregion } }