diff --git a/src/Umbraco.Web/Editors/UserController.cs b/src/Umbraco.Web/Editors/UserController.cs index 574591a088..6508d44205 100644 --- a/src/Umbraco.Web/Editors/UserController.cs +++ b/src/Umbraco.Web/Editors/UserController.cs @@ -11,6 +11,7 @@ using Umbraco.Web.Models.Mapping; using Umbraco.Web.Mvc; using legacyUser = umbraco.BusinessLogic.User; +using System.Net.Http; namespace Umbraco.Web.Editors @@ -37,6 +38,24 @@ namespace Umbraco.Web.Editors return Mapper.Map(user); } + /// + /// Changes the users password + /// + /// + /// + public HttpResponseMessage PostChangePassword(string oldPassword, string newPassword) + { + var u = UmbracoContext.Security.CurrentUser; + if(!System.Web.Security.Membership.ValidateUser(u.Username, oldPassword)) + return new HttpResponseMessage(HttpStatusCode.Unauthorized); + + u.Password = newPassword; + Services.UserService.SaveUser(u); + + + return new HttpResponseMessage(HttpStatusCode.OK); + } + /// /// Returns all active users ///