django-rest-framework-passwordless icon indicating copy to clipboard operation
django-rest-framework-passwordless copied to clipboard

Add additional context to send_email_with_callback_token template and plaintext

Open firstTimeCaller opened this issue 5 years ago • 2 comments

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.

firstTimeCaller avatar Feb 07 '20 12:02 firstTimeCaller

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.

jws avatar Feb 12 '20 06:02 jws

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.

firstTimeCaller avatar Feb 12 '20 06:02 firstTimeCaller