using System.Web.Mvc; using System.Web.UI; using Pilotfish.Afx.Security; using System.Web.Security; using Neo.Legitimate.Data.Models; namespace Pilotfish.Afx.Test.WebConsole.Controllers.Auth { public partial class AuthController { [OutputCache(Location = OutputCacheLocation.None)] public ActionResult ResetPassword() { 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 ResetPassword // POST: /Home/ResetPasswordToNew [HttpPost] public JsonResult ResetPasswordToNew(string oldPassword, string newPassword) { var success = false; if (Request.IsAuthenticated) { success = new LegitimateDatabase().ResetUserPassword(UserProfile.Current.UserID, UserProfile.Current.UserName, newPassword); } return Json(new { success }); } #endregion #endregion } }