From 76ee4c5de1049ef94fafcc4bc7df6adeb9a4e4df Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 2 Jul 2019 23:59:46 +0000 Subject: [PATCH] --- server/AyaNova/biz/UserBiz.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index 79a4249e..cdb352f4 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -58,8 +58,10 @@ namespace AyaNova.Biz inObj.Salt = Hasher.GenerateSalt(); inObj.Password = Hasher.hash(inObj.Salt, inObj.Password); - + inObj.Tags = TagUtil.NormalizeTags(inObj.Tags); + inObj.CustomFields=JsonUtil.CompactJson(inObj.CustomFields); + //Seeder sets user options in advance so no need to create them here in that case if (inObj.UserOptions == null) inObj.UserOptions = new UserOptions(); @@ -99,8 +101,10 @@ namespace AyaNova.Biz //This is a new user so it will have been posted with a password in plaintext which needs to be salted and hashed inObj.Salt = Hasher.GenerateSalt(); inObj.Password = Hasher.hash(inObj.Salt, inObj.Password); - + inObj.Tags = TagUtil.NormalizeTags(inObj.Tags); + inObj.CustomFields=JsonUtil.CompactJson(inObj.CustomFields); + //Seeder sets user options in advance so no need to create them here in that case if (inObj.UserOptions == null) inObj.UserOptions = new UserOptions(); @@ -256,7 +260,7 @@ namespace AyaNova.Biz //put internal bool Put(User dbObj, User inObj) { - + //Get a snapshot of the original db value object before changes User SnapshotOfOriginalDBObj = new User(); @@ -265,6 +269,7 @@ namespace AyaNova.Biz //Update the db object with the PUT object values CopyObject.Copy(inObj, dbObj, "Id, Salt"); dbObj.Tags = TagUtil.NormalizeTags(dbObj.Tags); + dbObj.CustomFields = JsonUtil.CompactJson(dbObj.CustomFields); //Is the user updating the password? if (!string.IsNullOrWhiteSpace(inObj.Password) && SnapshotOfOriginalDBObj.Password != inObj.Password) @@ -314,6 +319,7 @@ namespace AyaNova.Biz //Do the patching objectPatch.ApplyTo(dbObj); dbObj.Tags = TagUtil.NormalizeTags(dbObj.Tags); + dbObj.CustomFields=JsonUtil.CompactJson(dbObj.CustomFields); //Is the user patching the password? if (!string.IsNullOrWhiteSpace(dbObj.Password) && dbObj.Password != SnapshotOfOriginalDBObj.Password) @@ -568,7 +574,7 @@ namespace AyaNova.Biz return new { Id = o.Id, - ConcurrencyToken = o.ConcurrencyToken, + ConcurrencyToken = o.ConcurrencyToken, Active = o.Active, Name = o.Name, Roles = o.Roles,