From 6a212d9dfc6e73a82f83229a5f45f6362c715800 Mon Sep 17 00:00:00 2001 From: Horus_Arch Date: Tue, 10 Feb 2015 22:24:02 +0100 Subject: Try job feature. --- app/controllers/app.go | 5 +++-- app/controllers/mail.go | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/app.go b/app/controllers/app.go index fb11d01..5b38540 100644 --- a/app/controllers/app.go +++ b/app/controllers/app.go @@ -3,7 +3,7 @@ package controllers import ( "github.com/jinzhu/gorm" "github.com/revel/revel" - // "github.com/revel/revel/modules/jobs/app/jobs" + "github.com/revel/revel/modules/jobs/app/jobs" ) type App struct { @@ -179,7 +179,8 @@ func (c App) Register(email, confirmEmail, user, password, confirmPassword strin // Send email with confirmation link //jobs.Now(Mailer{}.ConfirmRegistration(email, key)) - _ = Mailer{}.ConfirmRegistration(user, email, key) + //_ = Mailer{}.ConfirmRegistration(user, email, key) + jobs.Now(AsyncConfirmRegistration(user, email, key)) c.Flash.Success("A mail with a confirmation link was sent. Please confirm your mail adress now.") return c.Redirect(App.PrintRegister) diff --git a/app/controllers/mail.go b/app/controllers/mail.go index b05da4e..9ca992a 100644 --- a/app/controllers/mail.go +++ b/app/controllers/mail.go @@ -14,6 +14,10 @@ func (u Mailer) SendConfirmationKey(email, key string) error { }) } +func (j jobs) AsyncConfirmRegistration(user, email, key string) { + _ = Mailer{}.ConfirmRegistration(user, email, key) +} + func (u Mailer) ConfirmRegistration(user, email, key string) error { return u.Send(revel_mailer.H{ "name": user, -- cgit v1.2.3