Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add callback to customize method of notifying magic link to user #39

Merged
merged 5 commits into from
Feb 5, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add callback to customize method of notifying magic link to user
  • Loading branch information
ykpythemind committed Feb 5, 2019
commit 68d8fd2ee12333e32d4e8b247e611d78d0517643
2 changes: 1 addition & 1 deletion app/controllers/passwordless/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create
session = build_passwordless_session(find_authenticatable)

if session.save
Mailer.magic_link(session).deliver_now
Passwordless.after_session_save.call(session)
end

render
Expand Down
2 changes: 2 additions & 0 deletions lib/passwordless.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ module Passwordless

mattr_accessor(:expires_at) { lambda { 1.year.from_now } }
mattr_accessor(:timeout_at) { lambda { 1.hour.from_now } }

mattr_accessor(:after_session_save) { lambda { |session| Mailer.magic_link(session).deliver_now } }
end