public override RoleGroup Create(string name) { RoleGroup item = new RoleGroup(); item.Index = Guid.NewGuid(); item.Name = name; data.RoleGroups.Add(item); data.SaveChanges(); return(item); }
public override bool ChangePassword(string username, string newPassword) { var item = data.MemberInfos.SingleOrDefault(t => t.Username.ToLower() == username.ToLower()); if (item == null) { return(false); } Random rnd = new Random(); item.Salt = new byte[6]; rnd.NextBytes(item.Salt); using (var sha = new System.Security.Cryptography.SHA1CryptoServiceProvider()) item.Password = sha.ComputeHash(sha.ComputeHash(System.Text.Encoding.UTF8.GetBytes(newPassword)).Concat(item.Salt).ToArray()); data.SaveChanges(); return(true); }