예제 #1
0
파일: register.go 프로젝트: ts25504/MuShare
func CreateUser(u *models.User, salt *models.Salts, body *user.Account) {
	u.Mail = body.Mail
	u.Name = body.Name
	u.Phone = body.Phone
	u.CreatedAt = time.Now().Unix()
	u.UpdatedAt = time.Now().Unix()
	salt.Salt = utils.EncryptRandSequence(5)
	DecodeSalt, _ := utils.TokenDecode(salt.Salt)
	u.Password, _ = utils.PsdHandler(body.Password, []byte(DecodeSalt))
}
예제 #2
0
func TestUserInsert(t *testing.T) {
	user := models.User{
		Name:     "liyifan",
		Mail:     "*****@*****.**",
		Phone:    "080-6761-1034",
		Password: "******",
	}
	user.CreatedAt = time.Now().Unix()
	user.UpdatedAt = time.Now().Unix()
	DB.Create(&user)
}