Example #1
0
File: app.go Project: puspesh/cdfs
func (c App) Login(user *models.User) revel.Result {
	user.Validate(c.Validation)

	// Handle errors
	if c.Validation.HasErrors() {
		c.Validation.Keep()
		c.FlashParams()
		return c.Redirect(App.Index)
	}
	// Ok, display the created user
	return c.Redirect(App.List)
	// return c.Render(user)
}
Example #2
0
File: app.go Project: puspesh/cdfs
func (c App) Upload(fname string, fid string, n string) revel.Result {
	user := new(models.User)
	user.Id = "6964943e-535a-4736-85ad-4baaa9656709"

	// Put the upload logic here
	// and then call FileUploaded() to add the metadata
	u := models.UserConfigData{Token: make(map[string]string)}
	f := models.FileMappingData{Parts: make(map[string]map[string]string)}
	u.Token["google"] = "/tmp/token"

	nn, _ := strconv.Atoi(n)
	models.UploadFiles("/tmp/"+fid, fname, nn, &u, &f)

	models.FileUploaded(user.Id, f.Parts, fid, fname)

	return c.Render()
}
Example #3
0
File: app.go Project: puspesh/cdfs
func (c App) List() revel.Result {
	user := new(models.User)
	user.Id = "6964943e-535a-4736-85ad-4baaa9656709"
	return c.Render(user)
}