public int InsertUserToDatabase() { registrationDate = DateTime.Now; salt = SHA2.GenerateSALT(); hash = SHA2.GenerateSHA256String(password, salt); if (id > 0) { LogManager.Report("trying to insert a user with a valid ID", this); } DateTime sqlMinDate = new DateTime(1800, 1, 1); if (BirthDate < sqlMinDate) { bdate = sqlMinDate; } if (RegistrationDate < sqlMinDate) { registrationDate = DateTime.Now; } int rowsEffected = db.InsertUser(this); foreach (var item in Articles) { db.FullArticleInsert(item); } return(rowsEffected); }
public void UpdateUserPasswords() { foreach (var item in db.GetAllUsers()) { if (item.Id >= 6) //All users that are not soccerDB { string email = item.FirstName.ToLower() + "@ruppin.ac.il"; string salt = SHA2.GenerateSALT(); string password = "******"; string hash = SHA2.GenerateSHA256String(password, salt); db.UpdateEmail(item.Id, email); db.UpdatePassword(item.Id, salt, hash); } } }
public int InsertUserToDatabase() { registrationDate = DateTime.Now; salt = SHA2.GenerateSALT(); hash = SHA2.GenerateSHA256String(password, salt); if (id > 0) { LogManager.Report("trying to insert a user with a valid ID", this); } DateTime sqlMinDate = new DateTime(1800, 1, 1); if (BirthDate < sqlMinDate) { bdate = sqlMinDate; } if (RegistrationDate < sqlMinDate) { registrationDate = DateTime.Now; } return(db.InsertUser(this)); }