Re: Setting an unusable password on an existing user

2012-09-23 Thread Nandakumar Chandrasekhar
Thanks Russ for your explanation. You are right I did not understand Andrew correctly. Forgive me for my ignorance. :-) I did not know there were so many ways to do the same thing. Thank you very much for the example. nav On Sunday 23 September 2012 05:16 AM, Russell Keith-Magee wrote: On

Re: Setting an unusable password on an existing user

2012-09-22 Thread Russell Keith-Magee
On Sat, Sep 22, 2012 at 3:18 PM, Nandakumar Chandrasekhar wrote: > Thanks Andrew but I have a requirement where I have to programmatically set > it to an unusable password based on a particular condition. Andrew's given you the answer - it's just not clear that you've understood what the answer i

Re: Setting an unusable password on an existing user

2012-09-22 Thread Jamie Lawrence
This isn't that rare - it is a common UX requirement. Set the value to something that cannot hash to any input. Depending on your setup, '0' could work, or any other nonsense value. If you have a strict DB schema, IIRC, there are some magic values that SHA will never generate, but I'd have to

Re: Setting an unusable password on an existing user

2012-09-22 Thread Nandakumar Chandrasekhar
Thanks Andrew but I have a requirement where I have to programmatically set it to an unusable password based on a particular condition. I know this is a rare requirement but in the context of the application I am building it makes sense. :-) nav On Friday 21 September 2012 12:22 PM, Andrew M

Re: Setting an unusable password on an existing user

2012-09-21 Thread Andrew Macgregor
AFAIK you can set it to ! in the admin interface. Don't use the change password form, just enter ! into the password field on the Auth User table. I believe this will cause has_usable_password() to return False. Cheers, Andrew. On Friday, September 21, 2012 2:16:22 PM UTC+8, nav wrote: > > Hi,

Re: Setting an unusable password on an existing user

2012-09-21 Thread Nandakumar Chandrasekhar
Thanks Paul, I have tried this on the Django shell and works for me as well. Since I am using some third party software to do social site authentication I might have made a mistake and not accessed the actual django user object. Thanks once again. nav On Friday 21 September 2012 03:17 PM,

Re: Setting an unusable password on an existing user

2012-09-21 Thread Paul Backhouse
Works for me... >>> from django.contrib.auth.models import User >>> user = User.objects.latest('id') >>> user.has_usable_password() True >>> user.set_unusable_password() >>> user.has_usable_password() False On Thu, 2012-09-20 at 23:16 -0700, nav wrote: > Hi, > > Is there any way to set the pass