diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/user.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/user.resource.js index 5c7b379704..2134efc594 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/user.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/user.resource.js @@ -68,6 +68,36 @@ function userResource($q, $http, umbRequestHelper) { "userApiBaseUrl", "GetAll")), 'Failed to retreive all users'); + }, + + /** + * @ngdoc method + * @name umbraco.resources.userResource#changePassword + * @methodOf umbraco.resources.userResource + * + * @description + * Changes the current users password + * + * ##usage + *
+ * contentResource.getAll()
+ * .then(function(userArray) {
+ * var myUsers = userArray;
+ * alert('they are here!');
+ * });
+ *
+ *
+ * @returns {Promise} resourcePromise object containing the user array.
+ *
+ */
+ changePassword: function (oldPassword, newPassword) {
+ return umbRequestHelper.resourcePromise(
+ $http.post(
+ umbRequestHelper.getApiUrl(
+ "userApiBaseUrl",
+ "PostChangePassword"),
+ { oldPassword: oldPassword, newPassword: newPassword }),
+ 'Failed to change password');
}
};
}
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/user.service.js b/src/Umbraco.Web.UI.Client/src/common/services/user.service.js
index 6b5a4cd7b5..54a5ae1999 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/user.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/user.service.js
@@ -72,7 +72,6 @@ angular.module('umbraco.services')
},
logout: function () {
-
return authResource.performLogout()
.then(function (data) {
currentUser = null;
diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/ChangePassword.html b/src/Umbraco.Web.UI.Client/src/views/dashboard/ChangePassword.html
index 1baa74b493..db41e8666a 100644
--- a/src/Umbraco.Web.UI.Client/src/views/dashboard/ChangePassword.html
+++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/ChangePassword.html
@@ -1,28 +1,49 @@
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js b/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js
index 5e5a03caa3..bf5e20a152 100644
--- a/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js
@@ -1,6 +1,4 @@
function startUpVideosDashboardController($scope, xmlhelper, $log, $http) {
-
-
//xmlHelper.parseFeed("http://umbraco.org/feeds/videos/getting-started").then(function(feed){
//});
@@ -18,17 +16,19 @@ function startUpVideosDashboardController($scope, xmlhelper, $log, $http) {
}
angular.module("umbraco").controller("Umbraco.Dashboard.StartupVideosController", startUpVideosDashboardController);
-function ChangePasswordDashboardController($scope, xmlhelper, $log, userService) {
+function ChangePasswordDashboardController($scope, xmlhelper, $log, userResource) {
//this is the model we will pass to the service
$scope.profile = {};
- $scope.changePassword = function (p) {
- userService.changePassword(p.oldPassword, p.newPassword).then(function () {
- //changed
- }, function () {
- //this only happens if there is a wrong oldPassword sent along
- $scope.passwordForm.oldPass.$setValidity("oldPassword", false);
- });
+ $scope.changePassword = function (p) {
+ userResource.changePassword(p.oldPassword, p.newPassword).then(function () {
+ alert("changed");
+ $scope.passwordForm.$setValidity(true);
+ }, function () {
+ alert("not changed");
+ //this only happens if there is a wrong oldPassword sent along
+ $scope.passwordForm.oldpass.$setValidity("oldPassword", false);
+ });
}
}
diff --git a/src/Umbraco.Web/Editors/UserController.cs b/src/Umbraco.Web/Editors/UserController.cs
index 6508d44205..6863b8fd93 100644
--- a/src/Umbraco.Web/Editors/UserController.cs
+++ b/src/Umbraco.Web/Editors/UserController.cs
@@ -12,6 +12,7 @@ using Umbraco.Web.Mvc;
using legacyUser = umbraco.BusinessLogic.User;
using System.Net.Http;
+using System.Collections.Specialized;
namespace Umbraco.Web.Editors
@@ -43,16 +44,16 @@ namespace Umbraco.Web.Editors
///
///
///