def forwards(self, orm): "Write your forwards methods here." actors = Actor.objects.all() for actor in actors: user = actor.user identity = Identity(actor=actor, msisdn=user.username) if user.password: # Copy over the raw password, we're using the same # hashing algorithm identity.pin = user.password identity.save()
def test_identity_pin_auth(self): farmer = utils.create_farmer() identity = Identity(actor=farmer.actor, msisdn='1234') identity.set_pin('5678') identity.save() self.assertTrue(identity.check_pin('5678')) self.assertFalse(identity.check_pin('4567'))