django-rest-framework-passwordless
django-rest-framework-passwordless copied to clipboard
Add email as a template context variable
I'm using this with a SPA in a browser context and need to build a url that contains all the information that will be needed to make the token obtain request (e.g: https://someapp.com/login?token=123456&[email protected])
Essentially, I want the user to be able to click on the link from the email instead of having to type the code manually.
you would need to use a custom email template.This has been explained in the readme or you can check #71 .
Looking to implement the same feature, there is an undocumented PASSWORDLESS_CONTEXT_PROCESSORS which looks like the right approach. I'm simply providing the context the token object and passing that to the consuming provider. Then you can access the user and email through that.
https://github.com/aaronn/django-rest-framework-passwordless/compare/master...nullablebool:patch-1
Just noticed how old this request is. A custom email template appears to only has access to the code, it would be helpful when adding a custom processor to know which user you're working with.