This commit is contained in:
2021-02-11 22:32:05 +00:00
parent 498759f93c
commit a3b391128d
2 changed files with 12 additions and 7 deletions

View File

@@ -13,7 +13,7 @@ namespace AyaNova.DataList
SQLFrom = "from auser left join avendor on (auser.vendorid=avendor.id)"; SQLFrom = "from auser left join avendor on (auser.vendorid=avendor.id)";
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType); var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
DefaultColumns = new List<string>() { "name", "employeenumber", "active", "usertype", "lastlogin", "roles" }; DefaultColumns = new List<string>() { "name", "employeenumber", "active", "usertype", "lastlogin" };
DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } }; DefaultSortBy = new Dictionary<string, string>() { { "name", "+" } };
FieldDefinitions = new List<DataListFieldDefinition>(); FieldDefinitions = new List<DataListFieldDefinition>();

View File

@@ -384,9 +384,11 @@ namespace AyaNova.Biz
putObject.Tags = TagBiz.NormalizeTags(putObject.Tags); putObject.Tags = TagBiz.NormalizeTags(putObject.Tags);
putObject.CustomFields = JsonUtil.CompactJson(putObject.CustomFields); putObject.CustomFields = JsonUtil.CompactJson(putObject.CustomFields);
await ValidateAsync(putObject, dbObject);
if (HasErrors) return null; //the salt is not sent with the put object, it's only location is in the db and since this putObject is replacing the dbObject
var OriginalSalt = dbObject.Salt; //we need to set it again here
putObject.Salt = dbObject.Salt;
var OriginalPW = dbObject.Password; var OriginalPW = dbObject.Password;
var OriginalLogin = dbObject.Login; var OriginalLogin = dbObject.Login;
ct.Replace(dbObject, putObject); ct.Replace(dbObject, putObject);
@@ -395,13 +397,12 @@ namespace AyaNova.Biz
if (!string.IsNullOrWhiteSpace(putObject.Password)) if (!string.IsNullOrWhiteSpace(putObject.Password))
{ {
//YES password is being updated: //YES password is being updated:
putObject.Password = Hasher.hash(OriginalSalt, putObject.Password); putObject.Password = Hasher.hash(putObject.Salt, putObject.Password);
} }
else else
{ {
//No, use the snapshot password value //No, use the snapshot password value
putObject.Password = OriginalPW; putObject.Password = OriginalPW;
putObject.Salt = OriginalSalt;
} }
//Updating login? //Updating login?
if (string.IsNullOrWhiteSpace(putObject.Login)) if (string.IsNullOrWhiteSpace(putObject.Login))
@@ -409,6 +410,10 @@ namespace AyaNova.Biz
//No, use the original value //No, use the original value
putObject.Login = OriginalLogin; putObject.Login = OriginalLogin;
} }
await ValidateAsync(putObject, dbObject);
if (HasErrors) return null;
try try
{ {
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();