diff options
| author | horus_arch | 2015-03-19 13:39:37 +0100 |
|---|---|---|
| committer | horus_arch | 2015-03-19 13:39:37 +0100 |
| commit | f334c93c0364d14a2b55641b155ad58f715a4b39 (patch) | |
| tree | 63ffbfc845f441802bd59c07adf2d9fe2f86c4bc /app/controllers/app.go | |
| parent | 3c9bdbc66998075278f7d79fa10709e7fab5deb6 (diff) | |
| download | freemail-f334c93c0364d14a2b55641b155ad58f715a4b39.tar.gz | |
Rewriting from scratch.
Diffstat (limited to 'app/controllers/app.go')
| -rw-r--r-- | app/controllers/app.go | 63 |
1 files changed, 0 insertions, 63 deletions
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() -} |
