public static bool Modify(string oldUserId, string newUserId, string password) { UsersEntity User = new UsersEntity(newUserId, EncriptionData.ComputeHash(password, EncriptionData.Supported_HA.SHA256, null)); if (oldUserId != newUserId) { return(DeleteUser(oldUserId) && NewUser(newUserId, password)); } return(DatabaseConnection.Modify <UsersEntity>(User, p => p.Username == oldUserId)); }
public static bool IsValidPAssword(string userID, string pw) { bool exists = false; using (var db = new InventoryContext(DatabaseConnection.ConnectionString)) { var q = from u in db.Users where u.Username == userID select u; foreach (var user in q) { exists = exists || EncriptionData.Confirm(pw, user.Password, EncriptionData.Supported_HA.SHA256); } } return(exists); }
public static bool NewUser(string userID, string password) { UsersEntity User = new UsersEntity(userID, EncriptionData.ComputeHash(password, EncriptionData.Supported_HA.SHA256, null)); return(DatabaseConnection.Add <UsersEntity>(User)); }