Expanded mail client for easier email operations.
This commit is contained in:
parent
3f053711ba
commit
e8d73421aa
5 changed files with 160 additions and 59 deletions
|
|
@ -84,10 +84,14 @@ func (c *ForgotPassword) Post(ctx echo.Context) error {
|
|||
ctx.Logger().Infof("generated password reset token for user %d", u.ID)
|
||||
|
||||
// Email the user
|
||||
err = c.Container.Mail.Send(ctx, u.Email, fmt.Sprintf(
|
||||
"Go here to reset your password: %s",
|
||||
ctx.Echo().Reverse("reset_password", u.ID, token),
|
||||
))
|
||||
url := ctx.Echo().Reverse("reset_password", u.ID, token)
|
||||
err = c.Container.Mail.
|
||||
Compose().
|
||||
To(u.Email).
|
||||
Subject("Reset your password").
|
||||
Body(fmt.Sprintf("Go here to reset your password: %s", url)).
|
||||
Send(ctx)
|
||||
|
||||
if err != nil {
|
||||
return c.Fail(ctx, err, "error sending password reset email")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue