This commit is contained in:
@@ -385,13 +385,16 @@ 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);
|
||||||
|
|
||||||
//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
|
//Fields not sent with the put object
|
||||||
//we need to set it again here
|
//(it's only location is in the db and since this putObject is replacing the dbObject we need to set it again here)
|
||||||
putObject.Salt = dbObject.Salt;
|
putObject.Salt = dbObject.Salt;
|
||||||
|
putObject.CurrentAuthToken=dbObject.CurrentAuthToken;
|
||||||
var OriginalPW = dbObject.Password;
|
putObject.DlKey=dbObject.DlKey;
|
||||||
var OriginalLogin = dbObject.Login;
|
putObject.DlKeyExpire=dbObject.DlKeyExpire;
|
||||||
ct.Replace(dbObject, putObject);
|
putObject.PasswordResetCode=dbObject.PasswordResetCode;
|
||||||
|
putObject.PasswordResetCodeExpire=dbObject.PasswordResetCodeExpire;
|
||||||
|
|
||||||
|
|
||||||
//NOTE: It's valid to call this without intending to change login or password (null values)
|
//NOTE: It's valid to call this without intending to change login or password (null values)
|
||||||
//Is the user updating the password?
|
//Is the user updating the password?
|
||||||
if (!string.IsNullOrWhiteSpace(putObject.Password))
|
if (!string.IsNullOrWhiteSpace(putObject.Password))
|
||||||
@@ -402,18 +405,18 @@ namespace AyaNova.Biz
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//No, use the snapshot password value
|
//No, use the snapshot password value
|
||||||
putObject.Password = OriginalPW;
|
putObject.Password = dbObject.Password;
|
||||||
}
|
}
|
||||||
//Updating login?
|
//Updating login?
|
||||||
if (string.IsNullOrWhiteSpace(putObject.Login))
|
if (string.IsNullOrWhiteSpace(putObject.Login))
|
||||||
{
|
{
|
||||||
//No, use the original value
|
//No, use the original value
|
||||||
putObject.Login = OriginalLogin;
|
putObject.Login = dbObject.Login;
|
||||||
}
|
}
|
||||||
|
|
||||||
await ValidateAsync(putObject, dbObject);
|
await ValidateAsync(putObject, dbObject);
|
||||||
if (HasErrors) return null;
|
if (HasErrors) return null;
|
||||||
|
ct.Replace(dbObject, putObject);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await ct.SaveChangesAsync();
|
await ct.SaveChangesAsync();
|
||||||
|
|||||||
@@ -56,26 +56,9 @@ namespace AyaNova.Models
|
|||||||
public bool Active { get; set; }
|
public bool Active { get; set; }
|
||||||
[Required, MaxLength(255)]
|
[Required, MaxLength(255)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public DateTime? LastLogin { get; set; }
|
public DateTime? LastLogin { get; set; }
|
||||||
|
|
||||||
public string Login { get; set; }
|
public string Login { get; set; }
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string Salt { get; set; }
|
|
||||||
[JsonIgnore]
|
|
||||||
public string CurrentAuthToken { get; set; }
|
|
||||||
[JsonIgnore]
|
|
||||||
public string DlKey { get; set; }
|
|
||||||
[JsonIgnore]
|
|
||||||
public DateTime? DlKeyExpire { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
|
||||||
public string PasswordResetCode { get; set; }
|
|
||||||
[JsonIgnore]
|
|
||||||
public DateTime? PasswordResetCodeExpire { get; set; }
|
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public AuthorizationRoles Roles { get; set; }
|
public AuthorizationRoles Roles { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
@@ -88,9 +71,24 @@ namespace AyaNova.Models
|
|||||||
public long? VendorId { get; set; }
|
public long? VendorId { get; set; }
|
||||||
public string Wiki { get; set; }
|
public string Wiki { get; set; }
|
||||||
public string CustomFields { get; set; }
|
public string CustomFields { get; set; }
|
||||||
|
|
||||||
public List<string> Tags { get; set; }
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
|
//======================
|
||||||
|
//NOT IN DTUSER CLASS
|
||||||
|
[JsonIgnore]
|
||||||
|
public string Salt { get; set; }//---
|
||||||
|
[JsonIgnore]
|
||||||
|
public string CurrentAuthToken { get; set; }//---
|
||||||
|
[JsonIgnore]
|
||||||
|
public string DlKey { get; set; }//---
|
||||||
|
[JsonIgnore]
|
||||||
|
public DateTime? DlKeyExpire { get; set; }//---
|
||||||
|
[JsonIgnore]
|
||||||
|
public string PasswordResetCode { get; set; }//---
|
||||||
|
[JsonIgnore]
|
||||||
|
public DateTime? PasswordResetCodeExpire { get; set; }//---
|
||||||
|
//==========================
|
||||||
|
|
||||||
//relations
|
//relations
|
||||||
//https://docs.microsoft.com/en-us/ef/core/modeling/relationships#other-relationship-patterns
|
//https://docs.microsoft.com/en-us/ef/core/modeling/relationships#other-relationship-patterns
|
||||||
[JsonIgnore]//hide from being returned (as null anyway) with User object in routes
|
[JsonIgnore]//hide from being returned (as null anyway) with User object in routes
|
||||||
|
|||||||
Reference in New Issue
Block a user