示例#1
0
func GenerateRandomUser() *auth.User {
	email := fmt.Sprintf("*****@*****.**", RandId(12))
	user := &auth.User{
		Email:  email,
		Scrypt: []byte{0},
		Salt:   []byte{0},
	}
	_, err := auth.SaveUser(user)
	if err != nil {
		panic(err)
	}
	return user
}
示例#2
0
func generateRandomUsers() []*auth.User {
	Info("Inserting random users")
	users := []*auth.User{}
	for i := 0; i < 1000; i++ {
		email := fmt.Sprintf("*****@*****.**", i)
		user := auth.LoadUserByEmail(email)
		if user == nil {
			user = &auth.User{
				Email:  email,
				Scrypt: []byte{0},
				Salt:   []byte{0},
			}
			_, err := auth.SaveUser(user)
			if err != nil {
				panic(err)
			}
		}
		users = append(users, user)
	}
	Info("Done inserting random users")
	return users
}