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 look that up. Why not have a "this account cannot log in" flag?
-j -- Sent from a phone, please excuse any terseness. On Sep 22, 2012, at 12:18 AM, Nandakumar Chandrasekhar <navanitach...@gmail.com> wrote: > 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 Macgregor wrote: >> 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, >> >> Is there any way to set the password of an existing user to and >> unusable value like none? >> >> I tried user.set_unusable_password() and subsequently user.save() >> but this did not work. >> >> Other than using this method is there a way to set the password to >> None or such like so that the user.has_usable_password() method will >> return False instead of True? >> >> Many Thanks, >> nav >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Django users" group. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/django-users/-/yhVjvHQNUekJ. >> To post to this group, send email to django-users@googlegroups.com. >> To unsubscribe from this group, send email to >> django-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-users@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.