aaronn / django-rest-framework-passwordless

Passwordless Auth for Django REST Framework
MIT License
708 stars 153 forks source link

Add additional context to send_email_with_callback_token template and plaintext #46

Open firstTimeCaller opened 4 years ago

firstTimeCaller commented 4 years ago

Hi Aaronn,

Thank you for the great project.

I am interested in having the emailed token within a URL. This will mean a user will only have to click on the anchor, rather then copying and pasting the token. As the users email is also required for auth_token I have added this in the link.

jws commented 4 years ago

a solution here should be generalizable to other use cases. your email link format for example, is unlikely to be usable by others.

another approach is to extend the context processing scaffold in inject_template_context and actually invoke the processors with sufficient context (i.e. email) to be actionable. right now, nothing is provided to the processors, which limits their usefulness. once that is in place, you can leverage the context processor extension + override the email template to format any url that you need.

firstTimeCaller commented 4 years ago

JWS, your suggestion is so much more elegant! I can't believe I didn't see the simpler solution of passing the user to the template. I will update accordingly.