diff --git a/src/Umbraco.Core/Models/Membership/User.cs b/src/Umbraco.Core/Models/Membership/User.cs index fb6161b994..a76b22f24b 100644 --- a/src/Umbraco.Core/Models/Membership/User.cs +++ b/src/Umbraco.Core/Models/Membership/User.cs @@ -255,12 +255,17 @@ namespace Umbraco.Core.Models.Membership public UserState UserState { get - { + { + if (LastLoginDate == default(DateTime) && IsApproved == false && InvitedDate != null) + return UserState.Invited; + if (LastLoginDate == default(DateTime) && InvitedDate == null && RawPasswordValue.StartsWith(Constants.Security.EmptyPasswordPrefix)) + return UserState.NoCredentials; + if (IsLockedOut) return UserState.LockedOut; if (IsApproved == false) return UserState.Disabled; - //TODO: Fill in the invite details + return UserState.Active; } } diff --git a/src/Umbraco.Core/Models/Membership/UserState.cs b/src/Umbraco.Core/Models/Membership/UserState.cs index 5f6ee1615a..b48683b00d 100644 --- a/src/Umbraco.Core/Models/Membership/UserState.cs +++ b/src/Umbraco.Core/Models/Membership/UserState.cs @@ -9,6 +9,11 @@ Active = 0, Disabled = 1, LockedOut = 2, - Invited = 3 + Invited = 3, + + /// + /// Occurs when the user has been created (not invited) and has no credentials assigned + /// + NoCredentials = 4 } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/users/changepassword.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/users/changepassword.directive.js index d1626e21a3..f70fc5ec7d 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/users/changepassword.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/users/changepassword.directive.js @@ -139,6 +139,7 @@ return !$scope.passwordValues.reset; }; + //TODO: I don't think we need this or the cancel button, this can be up to the editor rendering this directive $scope.showCancelBtn = function () { return $scope.config.disableToggle !== true && $scope.config.hasPassword; }; diff --git a/src/Umbraco.Web.UI.Client/src/views/users/user.controller.js b/src/Umbraco.Web.UI.Client/src/views/users/user.controller.js index d8859f223e..2c1c983759 100644 --- a/src/Umbraco.Web.UI.Client/src/views/users/user.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/users/user.controller.js @@ -42,19 +42,22 @@ vm.user = user; makeBreadcrumbs(vm.user); setUserDisplayState(); - vm.loading = false; - }); - //go get the config for the membership provider and add it to the model - authResource.getMembershipProviderConfig().then(function (data) { - vm.changePasswordModel.config = data; - //ensure the hasPassword config option is set to true (the user of course has a password already assigned) - //this will ensure the oldPassword is shown so they can change it - // disable reset password functionality beacuse it does not make sense inside the backoffice - vm.changePasswordModel.config.hasPassword = true; - vm.changePasswordModel.config.disableToggle = true; - vm.changePasswordModel.config.enableReset = false; - }); + //go get the config for the membership provider and add it to the model + authResource.getMembershipProviderConfig().then(function (data) { + vm.changePasswordModel.config = data; + + //the user has a password if they are not states: Invited, NoCredentials + vm.changePasswordModel.config.hasPassword = vm.user.userState !== 3 && vm.user.userState !== 4; + + vm.changePasswordModel.config.disableToggle = true; + // disable reset password functionality beacuse it does not make sense inside the backoffice + vm.changePasswordModel.config.enableReset = false; + + vm.loading = false; + }); + + }); } function toggleChangePassword() {