Ejemplo n.º 1
0
        public static List <User> GenerateUsers()
        {
            // a list of users to seed
            List <User> users = new List <User>();


            //!! Can't go over 9, or guid.parse won't work
            for (var i = 0; i < 9; i++)
            {
                int index = i + 1;

                var tempGuid = Guid.Parse($"{index}a8d0bfb-74a5-48f4-a729-0a945011ee4f");
                users.Add(
                    new User
                {
                    //Id = new Guid(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte)index, }),
                    Id           = tempGuid,
                    Email        = $"test{index}@test.com",
                    Password     = PasswordEncryptor.Hash($"Secret{index}").PasswordHash,
                    PasswordSalt = PasswordEncryptor.Hash($"Secret{index}").PasswordSalt,
                    CreatedDate  = DateTime.UtcNow.AddDays(-index)
                });
            }

            return(users);
        }
Ejemplo n.º 2
0
 private byte[] GetPasswordSalt(UserInputModel uim, User u)
 {
     return(PasswordEncryptor.Hash(uim.Password).PasswordSalt);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 生成密码哈希值
 /// </summary>
 public string PasswordHash(string password)
 {
     return(PasswordEncryptor.Hash(password));
 }