This commit is contained in:
2018-09-04 21:56:43 +00:00
parent a5f9759a7c
commit 43db21cccd
4 changed files with 48 additions and 72 deletions

View File

@@ -50,7 +50,7 @@ namespace AyaNova.Biz
InventoryFull | AccountingFull | TechLimited | TechFull | SubContractorLimited |
SubContractorFull | ClientLimited | ClientFull | OpsAdminLimited | OpsAdminFull
}//end SecurityLevelTypes
}//end AuthorizationRoles
}//end namespace GZTW.AyaNova.BLL

View File

@@ -36,6 +36,10 @@ namespace AyaNova.Biz
//CREATE
internal async Task<User> CreateAsync(User inObj)
{
//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);
Validate(inObj, true);
if (HasErrors)
return null;
@@ -44,6 +48,8 @@ namespace AyaNova.Biz
//do stuff with User
User outObj = inObj;
outObj.OwnerId = userId;
//SearchHelper(break down text fields, save to db)
//TagHelper(collection of tags??)
await ct.User.AddAsync(outObj);
@@ -317,8 +323,8 @@ namespace AyaNova.Biz
AddError(ValidationErrorType.InvalidValue, "Roles");
}
//Name must be less than 255 characters
if (inObj.EmployeeNumber.Length > 255)
//Optional employee number field must be less than 255 characters
if (!string.IsNullOrWhiteSpace(inObj.EmployeeNumber) && inObj.EmployeeNumber.Length > 255)
AddError(ValidationErrorType.LengthExceeded, "EmployeeNumber", "255 max");

View File

@@ -18,8 +18,7 @@ namespace AyaNova.Models
[Required]
public string Login { get; set; }
[Required]
public string Password { get; set; }
[Required]
public string Password { get; set; }
public string Salt { get; set; }
[Required]
public AuthorizationRoles Roles { get; set; }