Class: UserMailer
- Inherits:
-
ApplicationMailer
- Object
- ActionMailer::Base
- ApplicationMailer
- UserMailer
- Defined in:
- app/mailers/user_mailer.rb
Instance Method Summary collapse
-
#magic_link(email, token) ⇒ Object
Passwordless sign-in link.
Instance Method Details
#magic_link(email, token) ⇒ Object
Passwordless sign-in link. ‘email` is a raw string (the recipient may not have an account yet). Token is a signed MagicLink payload (email + return_to + jti, single-use). Clicking the link logs the recipient in or creates their account. App-name-aware so the same template serves every Studio app.
Engine GENERIC base. An app needing richer copy (e.g. turf-monster’s contest-aware variant) defines its own UserMailer, which wins.
13 14 15 16 17 18 19 20 |
# File 'app/mailers/user_mailer.rb', line 13 def magic_link(email, token) @app_name = Studio.app_name @email = email @magic_url = magic_link_url_for(token) @banner_url = Studio::EmailImage.url(:magic_link) # admin-managed; nil renders bannerless @banner_alt = "Your #{@app_name} sign-in link" mail(to: email, subject: "Your #{@app_name} sign-in link") end |