Задать вопрос

Тел: +7 965 3737 888

506

Просмотров

1

Ответов

Trigger a user password change

<p>I would like to catch the raw plaintext password if a user created or change his password. First i tried to handle this with signals.post_save at the User class, like this:
</p>
<p>dispatcher.connect(update, signal=signals.post_save, sender=User)
</p>
<p>The problem is, in the User model exists e.g. 'last_login'. So the save method called every time, the user logged in :( And with post_save i get only the hashed password and not the plaintext source password.
</p>
<p>I found a simple way to trigger a user password change. I hacked directly into the django.contrib.auth.models.User.set_password() method. See the sourcecode.
</p>
<p>There exists a discussion in the <a href="http://groups.google.com/group/django-users/browse_thread/thread/7c074e80a9cdcd21/">django-users thread</a> about this.
</p>

Вопрос полезен? Да0/Нет0
file_4316.py(523.0б)
None

Ответы (1):

Ответgamesbook:27.10.2010
Ответ полезен? Да0/Нет0

Its not clear how to make use of this snippet? What is required in order to integrate into Django (and the Admin site)?