abevoelker/devise-passwordless

Own Mailer Class + Postmark Templates. Magic Link not working

freebian opened this issue · 2 comments

Hi,

I am using https://postmarkapp.com/ email template for all my emails.
Unfortunately I cannot figure out how to send working magic links via postmark templates.

I've overwritten the mailer method and set a custom Mailer inside the Devise's initializer, wich works.
The issue is that the following seems to generate an invalid magic link?
Do I miss something here?

def magic_link(record, token, remember_me, opts = {})
      self.template_model = {
        user: {
          magic_link_url: send("users_magic_link_url", Hash["user", {email: record.email, token: token, remember_me: remember_me}]),
          magic_link_validity: Devise.passwordless_login_within.inspect
        }
      }
      mail to: record.email, postmark_template_alias: 'magic-link'
end

Any hints appreciated,
Thanks a lot.

This does actually work. I had a comma at the end which I did no realise. Sorry about that.

No problem; didn't get a chance to look at your issue before you figured it out, but glad you did 🎉