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

Add email as a template context variable

Open arshsingh opened this issue 5 years ago • 2 comments

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.

arshsingh avatar Apr 30 '20 01:04 arshsingh

you would need to use a custom email template.This has been explained in the readme or you can check #71 .

jaymes15 avatar Sep 17 '21 08:09 jaymes15

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.

nullablebool avatar May 05 '22 03:05 nullablebool