예제 #1
0
        private static IEnumerable <User> DefaultUsers(Programme[] programmes)
        {
            var users = new List <User>();

            for (var i = 1; i < 400; i++)
            {
                var user = generateUser(i, programmes.Where(p => !p.Hidden).ToArray());
                user.Id = i;
                users.Add(user);
            }

            CreatePasswordHash(defaultPassword, out var hash, out var salt);
            var admin = new User
            {
                Student = new Student
                {
                    Email          = "*****@*****.**",
                    ProgrammeId    = 1000,
                    Description    = "I'm an admin, i dont need your opinion",
                    FirstName      = "Admin",
                    LastName       = "Adminsson",
                    Private        = true,
                    Searching      = false,
                    ProfilePicture = null,
                    Url            = ProfileBuilder.NewProfileUrl(25)
                },
                Email        = "*****@*****.**",
                PasswordHash = hash,
                PasswordSalt = salt,
                Role         = Role.Admin
            };

            users.Add(admin);
            return(users);
        }
예제 #2
0
 public static User NewUser(string email, string password, string firstname, string lastname, int programmeid,
                            string role)
 {
     CreatePasswordHash(password, out var hash, out var salt);
     return(new User
     {
         Email = email,
         PasswordHash = hash,
         PasswordSalt = salt,
         Role = role,
         Student = new Student
         {
             Searching = false,
             Private = false,
             Description = "Skriv något om dig själv...",
             Url = ProfileBuilder.NewProfileUrl(25),
             ProgrammeId = programmeid,
             FirstName = firstname,
             LastName = lastname,
             Email = email
         }
     });
 }