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

Extract send_magic_link out to a method #59

Merged
merged 1 commit into from
May 1, 2024

Conversation

iainbeeston
Copy link
Contributor

I've extracted the code to send the magic link out to it's own method, which allows it to be overridden in other apps using this gem if they want to perform additional actions when the email is sent successfully. One of the strengths of devise is having overridable methods like this, so I feel that it's in-keeping with how other devise controllers work.

This can already be done using the send_magic_link method on the "user" model, but sometimes the logic you want to add doesn't make sense in the model layer. In my case I'd like to add additional tracking (similar to the trackable devise module) which requires access to the request object.

@abevoelker
Copy link
Owner

Yep makes sense to me! Could you replace the resource_class.find_by with resource_class.find_for_authentication per the change from #55 so that I can get a clean rebase without conflicts? Then I will merge

I've extracted the code to send the magic link out to it's own method, which allows it to be overridden in other apps using this gem if they want to perform additional actions when the email is sent successfully.

This can already be done using the `send_magic_link` method on the "user" model, but sometimes the logic you want to add doesn't make sense in the model layer.
@iainbeeston
Copy link
Contributor Author

@abevoelker Great, thank you! I've rebased it now

@iainbeeston
Copy link
Contributor Author

Hey @abevoelker sorry for the nudge, but is there any chance of getting this merged and released? 🙏

@abevoelker abevoelker merged commit 8c62bb8 into abevoelker:master May 1, 2024
14 checks passed
@abevoelker
Copy link
Owner

@iainbeeston Don't be sorry! Released now as 1.0.3. Thanks for your contrib! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants