From f334c93c0364d14a2b55641b155ad58f715a4b39 Mon Sep 17 00:00:00 2001 From: horus_arch Date: Thu, 19 Mar 2015 13:39:37 +0100 Subject: Rewriting from scratch. --- app/controllers/app.go | 63 -------------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 app/controllers/app.go (limited to 'app/controllers/app.go') diff --git a/app/controllers/app.go b/app/controllers/app.go deleted file mode 100644 index 2b8945c..0000000 --- a/app/controllers/app.go +++ /dev/null @@ -1,63 +0,0 @@ -package controllers - -import ( - _ "github.com/jinzhu/gorm" - _ "github.com/mattn/go-sqlite3" - "github.com/revel/revel" -) - -type App struct { - //*revel.Controller - GormController -} - -func (c App) Index() revel.Result { - return c.Render() -} - -func (c App) DoRegister(name, email, confirmEmail, password, confirmPassword string) revel.Result { - c.Validation.Required(name).Message("Please provide a user name.") - c.Validation.Required(email).Message("Please provide a mail adress.") - c.Validation.Required(email == confirmEmail).Message("Mail adresses do not match.") - c.Validation.Required(password).Message("Please provide a password.") - c.Validation.Required(password == confirmPassword).Message("Passwords do not match.") - - if c.Validation.HasErrors() { - c.Validation.Keep() - c.FlashParams() - return c.Redirect(App.Register) - } - - hash := HashPassword(password) - revel.INFO.Printf("%s \n", hash) - user := User{Name: name, Email: email, Password: hash} - - //c.Validation.Required(c.Db.NewRecord(user)).Message("User name already used.") - /* - if !c.Db.NewRecord(user) { - revel.ERROR.Println("User name already in use.") - } - */ - - revel.INFO.Printf("%s", c.Gdb) - c.Gdb.Debug().NewRecord(user) - c.Gdb.Debug().Save(&user) - //c.Db.Debug().NewRecord(user) - //c.Db.Debug().Save(&user) - //c.Db.Create(&user) - - /* - if c.Validation.HasErrors() { - c.Validation.Keep() - c.FlashParams() - return c.Redirect(App.Register) - } - */ - - //return c.Render() - return c.Redirect(App.Register) -} - -func (c App) Register() revel.Result { - return c.Render() -} -- cgit v1.2.3