From 146f938051de358983c44d8444c3d13c70522466 Mon Sep 17 00:00:00 2001 From: nikolajlauridsen Date: Fri, 1 Apr 2022 13:30:32 +0200 Subject: [PATCH] Do a full save on first member login --- src/Umbraco.Infrastructure/Security/MemberUserStore.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Infrastructure/Security/MemberUserStore.cs b/src/Umbraco.Infrastructure/Security/MemberUserStore.cs index 345a404fcf..d2b0db111c 100644 --- a/src/Umbraco.Infrastructure/Security/MemberUserStore.cs +++ b/src/Umbraco.Infrastructure/Security/MemberUserStore.cs @@ -597,7 +597,10 @@ namespace Umbraco.Cms.Core.Security || (member.LastLoginDate != default && identityUser.LastLoginDateUtc.HasValue == false) || (identityUser.LastLoginDateUtc.HasValue && member.LastLoginDate.ToUniversalTime() != identityUser.LastLoginDateUtc.Value)) { - changeType = MemberDataChangeType.LoginOnly; + // If the LastLoginDate is default on the member we have to do a full save. + // This is because the umbraco property data for the member doesn't exist yet in this case + // meaning we can't just update that property data, but have to do a full save to create it + changeType = member.LastLoginDate == default ? MemberDataChangeType.FullSave : MemberDataChangeType.LoginOnly; // if the LastLoginDate is being set to MinValue, don't convert it ToLocalTime DateTime dt = identityUser.LastLoginDateUtc == DateTime.MinValue ? DateTime.MinValue : identityUser.LastLoginDateUtc.Value.ToLocalTime();