diff options
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/app.go | 10 | ||||
| -rw-r--r-- | app/controllers/mail.go | 23 |
2 files changed, 29 insertions, 4 deletions
diff --git a/app/controllers/app.go b/app/controllers/app.go index 5b38540..9e5764f 100644 --- a/app/controllers/app.go +++ b/app/controllers/app.go @@ -180,8 +180,16 @@ 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) - jobs.Now(AsyncConfirmRegistration(user, email, key)) + jobs.Now(JobRegistration{User: user, Email: email, Key: key}) c.Flash.Success("A mail with a confirmation link was sent. Please confirm your mail adress now.") return c.Redirect(App.PrintRegister) } + +func (c App) Test(email, key string) revel.Result { + // jobs.Now(JobRegistration{User: "foobar", Email: email, Key: key}) + Mailer{}.ConfirmRegistration("foobar", "raspi@dns.iamfabulous.de", "string") + c.Flash.Success("A mail with a confirmation link was sent. Please confirm your mail adress now.") + + return c.Redirect(App.Index) +} diff --git a/app/controllers/mail.go b/app/controllers/mail.go index 9ca992a..3fd2e94 100644 --- a/app/controllers/mail.go +++ b/app/controllers/mail.go @@ -1,11 +1,22 @@ package controllers -import "github.com/tanema/revel_mailer" +import ( + "github.com/tanema/revel_mailer" +) type Mailer struct { revel_mailer.Mailer } +type JobConfirmationKey struct { + Email string + Key string +} + +func (j JobConfirmationKey) Run() { + _ = Mailer{}.SendConfirmationKey(j.Email, j.Key) +} + func (u Mailer) SendConfirmationKey(email, key string) error { return u.Send(revel_mailer.H{ "subject": "Confirmation Key", @@ -14,8 +25,14 @@ func (u Mailer) SendConfirmationKey(email, key string) error { }) } -func (j jobs) AsyncConfirmRegistration(user, email, key string) { - _ = Mailer{}.ConfirmRegistration(user, email, key) +type JobRegistration struct { + User string + Email string + Key string +} + +func (j JobRegistration) Run() { + _ = Mailer{}.ConfirmRegistration(j.User, j.Email, j.Key) } func (u Mailer) ConfirmRegistration(user, email, key string) error { |
