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 b113fdf93e..feb28eda13 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
@@ -105,7 +105,12 @@ function ChangePasswordDashboardController($scope, xmlhelper, $log, userResource
$scope.changePassword = function() {
if (formHelper.submitForm({ scope: $scope })) {
- userResource.changePassword($scope.changePasswordModel.value).then(function() {
+ userResource.changePassword($scope.changePasswordModel.value).then(function(data) {
+
+ //if the password has been reset, then update our model
+ if (data.value) {
+ $scope.changePasswordModel.value.generatedPassword = data.value;
+ }
formHelper.resetForm({ scope: $scope, notifications: data.notifications });
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.controller.js
index f56a37058f..01101e73e9 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.controller.js
@@ -76,9 +76,15 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.ChangePasswordCont
//listen for the saved event, when that occurs we'll
//change to changing = false;
$scope.$on("formSubmitted", function () {
- $scope.changing = false;
+ if ($scope.model.config.disableToggle === false) {
+ $scope.changing = false;
+ }
resetModel();
});
+ $scope.$on("formSubmitting", function() {
+ //if there was a previously generated password displaying, clear it
+ $scope.model.value.generatedPassword = null;
+ });
$scope.showReset = function() {
return $scope.model.config.hasPassword && $scope.model.config.enableReset;
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.html
index 525e1c2ee3..b86f066546 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/changepassword/changepassword.html
@@ -1,53 +1,53 @@
-
-
-
-
- Password has been reset to:
-
- {{model.value.generatedPassword}}
-
-
-
Change password
+
+
+ Password has been reset to:
+
+ {{model.value.generatedPassword}}
-
\ No newline at end of file
diff --git a/src/Umbraco.Web/Editors/UserController.cs b/src/Umbraco.Web/Editors/UserController.cs
index 5014c53eb3..ca8974d852 100644
--- a/src/Umbraco.Web/Editors/UserController.cs
+++ b/src/Umbraco.Web/Editors/UserController.cs
@@ -8,10 +8,13 @@ using System.Web.Http;
using System.Web.Security;
using AutoMapper;
using Umbraco.Core.Configuration;
+using Umbraco.Web.Models;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Models.Mapping;
using Umbraco.Web.Mvc;
+using Umbraco.Web.UI;
using Umbraco.Web.WebApi;
+using umbraco;
using legacyUser = umbraco.BusinessLogic.User;
using System.Net.Http;
using System.Collections.Specialized;
@@ -62,9 +65,9 @@ namespace Umbraco.Web.Editors
///
///
///
- /// If the password is being reset it will return the newly reset password, otherwise will return null;
+ /// If the password is being reset it will return the newly reset password, otherwise will return an empty value
///
- public string PostChangePassword(ChangingPasswordModel data)
+ public ModelWithNotifications
PostChangePassword(ChangingPasswordModel data)
{
var userProvider = Membership.Providers[UmbracoConfig.For.UmbracoSettings().Providers.DefaultBackOfficeUserProvider];
if (userProvider == null)
@@ -82,10 +85,13 @@ namespace Umbraco.Web.Editors
if (passwordChangeResult.Success)
{
//even if we weren't resetting this, it is the correct value (null), otherwise if we were resetting then it will contain the new pword
- return passwordChangeResult.Result.ResetPassword;
+ var result = new ModelWithNotifications(passwordChangeResult.Result.ResetPassword);
+ result.AddSuccessNotification(ui.Text("user", "password"), ui.Text("user", "passwordChanged"));
+ return result;
}
- //it wasn't successful, so add the change error to the model state
+ //it wasn't successful, so add the change error to the model state, we've name the property alias _umb_password on the form
+ // so that is why it is being used here.
ModelState.AddPropertyError(
passwordChangeResult.Result.ChangeError,
string.Format("{0}password", Constants.PropertyEditors.InternalGenericPropertiesPrefix));
diff --git a/src/Umbraco.Web/Models/ContentEditing/ChangingPasswordModel.cs b/src/Umbraco.Web/Models/ChangingPasswordModel.cs
similarity index 97%
rename from src/Umbraco.Web/Models/ContentEditing/ChangingPasswordModel.cs
rename to src/Umbraco.Web/Models/ChangingPasswordModel.cs
index 362894ca42..935d9d3ccf 100644
--- a/src/Umbraco.Web/Models/ContentEditing/ChangingPasswordModel.cs
+++ b/src/Umbraco.Web/Models/ChangingPasswordModel.cs
@@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
-namespace Umbraco.Web.Models.ContentEditing
+namespace Umbraco.Web.Models
{
///
/// A model representing an attempt at changing a password
diff --git a/src/Umbraco.Web/Models/ContentEditing/INotificationModel.cs b/src/Umbraco.Web/Models/ContentEditing/INotificationModel.cs
index 9480a528ae..401ced3c91 100644
--- a/src/Umbraco.Web/Models/ContentEditing/INotificationModel.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/INotificationModel.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -7,6 +8,7 @@ namespace Umbraco.Web.Models.ContentEditing
///
/// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes.
///
+ [DataMember(Name = "notifications")]
List Notifications { get; }
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Web/Models/ContentEditing/ModelWithNotifications.cs b/src/Umbraco.Web/Models/ContentEditing/ModelWithNotifications.cs
new file mode 100644
index 0000000000..4d45304e44
--- /dev/null
+++ b/src/Umbraco.Web/Models/ContentEditing/ModelWithNotifications.cs
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+namespace Umbraco.Web.Models.ContentEditing
+{
+ ///
+ /// A generic model supporting notifications, this is useful for returning any model type to include notifications from api controllers
+ ///
+ ///
+ [DataContract(Name = "model", Namespace = "")]
+ public class ModelWithNotifications : INotificationModel
+ {
+ public ModelWithNotifications(T value)
+ {
+ Value = value;
+ Notifications = new List();
+ }
+
+ ///
+ /// The generic value
+ ///
+ [DataMember(Name = "value")]
+ public T Value { get; private set; }
+
+ ///
+ /// The notifications
+ ///
+ [DataMember(Name = "notifications")]
+ public List Notifications { get; private set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Umbraco.Web/Security/WebSecurity.cs b/src/Umbraco.Web/Security/WebSecurity.cs
index 5b236da7f1..6192f8471a 100644
--- a/src/Umbraco.Web/Security/WebSecurity.cs
+++ b/src/Umbraco.Web/Security/WebSecurity.cs
@@ -11,6 +11,7 @@ using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Security;
+using Umbraco.Web.Models;
using Umbraco.Web.Models.ContentEditing;
using umbraco;
using umbraco.DataLayer;
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index 9c9a79fac1..e81d9f047a 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -313,7 +313,8 @@
-
+
+