public System.Web.Mvc.ActionResult HttpPost(Page_Context context, PagePositionContext positionContext) { AntiForgery.Validate(); try { var httpContext = context.ControllerContext.HttpContext; var repository = Repository.Current; var textFolder = new TextFolder(repository, "Members"); var userContent = MemberAuth.GetMemberContent(); var oldPassword = httpContext.Request.Form["OldPassword"]; var newPassword = httpContext.Request.Form["NewPassword"]; if (userContent["PasswordSalt"] != null) { oldPassword = MemberAuth.EncryptPassword(oldPassword, userContent["PasswordSalt"].ToString()); } if (userContent["password"].ToString() == oldPassword) { var passwordSalt = ""; if (userContent["PasswordSalt"] == null) { passwordSalt = MemberAuth.GenerateSalt(); } else { passwordSalt = userContent["PasswordSalt"].ToString(); } newPassword = MemberAuth.EncryptPassword(newPassword, passwordSalt); ServiceFactory.TextContentManager.Update(textFolder, userContent.UUID, new string[] { "Password", "PasswordSalt" }, new object[] { newPassword, passwordSalt }); context.ControllerContext.Controller.ViewBag.Message = "The password has been changed.".RawLabel().ToString(); } else { context.ControllerContext.Controller.ViewData.ModelState.AddModelError("", "The old password is invalid.".RawLabel().ToString()); } } catch (Exception e) { context.ControllerContext.Controller.ViewData.ModelState.AddModelError("", e); Kooboo.HealthMonitoring.Log.LogException(e); } return(null); }
public System.Web.Mvc.ActionResult HttpPost(Page_Context context, PagePositionContext positionContext) { AntiForgery.Validate(); try { var httpContext = context.ControllerContext.HttpContext; var repository = Repository.Current; var textFolder = new TextFolder(repository, "Members"); var userContent = MemberAuth.GetMemberContent(); var email = httpContext.Request.Form["Email"]; var language = httpContext.Request.Form["Language"]; ServiceFactory.TextContentManager.Update(textFolder, userContent.UUID, new string[] { "Email", "Language" }, new object[] { email, language }); } catch (Exception e) { context.ControllerContext.Controller.ViewData.ModelState.AddModelError("", e); Kooboo.HealthMonitoring.Log.LogException(e); } return(null); }
private ActionResult SignOut(Page_Context context) { MemberAuth.SignOut(); return(new RedirectResult(context.Url.FrontUrl().PageUrl("SignIn").ToString())); }