Added failed password test result

This commit is contained in:
emmagarland
2021-02-28 19:09:02 +00:00
parent c84564f0d6
commit d67f4d7ec1
2 changed files with 76 additions and 16 deletions

View File

@@ -495,18 +495,20 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers
return new ValidationErrorResult(new SimpleValidationModel(ModelState.ToErrorDictionary()));
}
if (passwordChangeResult.Success)
if (!passwordChangeResult.Success)
{
// get the identity member now the password and dates have changed
identityMember = await _memberManager.FindByIdAsync(contentItem.Id.ToString());
return new ValidationErrorResult("The password could not be changed");
}
//TODO: confirm this is correct
contentItem.PersistedContent.RawPasswordValue = identityMember.PasswordHash;
// get the identity member now the password and dates have changed
identityMember = await _memberManager.FindByIdAsync(contentItem.Id.ToString());
if (identityMember.LastPasswordChangeDateUtc != null)
{
contentItem.PersistedContent.LastPasswordChangeDate = (DateTime)identityMember.LastPasswordChangeDateUtc;
}
//TODO: confirm this is correct
contentItem.PersistedContent.RawPasswordValue = identityMember.PasswordHash;
if (identityMember.LastPasswordChangeDateUtc != null)
{
contentItem.PersistedContent.LastPasswordChangeDate = (DateTime)identityMember.LastPasswordChangeDateUtc;
}
}