Re: Authentication backend - serialization

2017-06-08 Thread Alison P
Hi! Ludovic, Melvyn, thank you for your responses. I could not make Melvyn's example work for me, but it put me on the right track. Solution: right under the "reset the one time password" comment, add the line "user.backend = 'path.to.OneTimePasswordBackend' ", and everything works as it shoul

Re: Authentication backend - serialization

2017-06-05 Thread Melvyn Sopacua
On Monday 05 June 2017 04:14:01 Alison P wrote: > If I use the default session serializer, I get the following error: > TypeError at /login/ > > is not JSON serializable I'm using this is a general solution. Feel free to strike what you don't need. The basics is that a JSONEncoder knows primiti

Re: Authentication backend - serialization

2017-06-05 Thread ludovic coues
I don't see where in your code the error happen. With standard python, you can't add a method on your class to make is JSON serializable. At least to my knowledge. You have to write your own serializer and instruct the code turning your object into JSON to use it. But there are a few easier alter

Authentication backend - serialization

2017-06-05 Thread Alison P
Hi everyone, I have written a custom authentication backend, the code is below. It allows a user to click "email me a one-time password" on the home page, which is saved on the "Person" model (which extends User through a foreign key) and then log in with that password. This backend verifies th