This commit is contained in:
2019-07-02 23:59:46 +00:00
parent e4996d683d
commit 76ee4c5de1

View File

@@ -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,