Пример #1
0
 def test_makes_verifier(self):
     srpinfo = SRPUserInfo(user=User.objects.get(username='******'))
     srpinfo.set_from_password("asdf")
     self.assertTrue(srpinfo.salt)
     self.assertTrue(srpinfo.verifier)
     # print 'Salt:     <%s>' % srpinfo.salt
     # print 'Verifier: <%s>' % srpinfo.verifier
     self.assertTrue(re.match(r'^[a-zA-Z0-9/+=]+$', srpinfo.salt))
     self.assertTrue(re.match(r'^[a-zA-Z0-9/+=]+$', srpinfo.verifier))
Пример #2
0
 def test_makes_verifier(self):
     srpinfo = SRPUserInfo(user=User.objects.get(username='******'))
     srpinfo.set_from_password("asdf")
     self.assertTrue(srpinfo.salt)
     self.assertTrue(srpinfo.verifier)
     # print 'Salt:     <%s>' % srpinfo.salt
     # print 'Verifier: <%s>' % srpinfo.verifier
     self.assertTrue(re.match(r'^[a-zA-Z0-9/+=]+$', srpinfo.salt))
     self.assertTrue(re.match(r'^[a-zA-Z0-9/+=]+$', srpinfo.verifier))
Пример #3
0
 def handle(self, *args, **options):
     if len(args) != 2:
         raise CommandError("must specify username and password")
     username = args[0]
     password = args[1]
     try:
         user = User.objects.get(username=username)
     except User.DoesNotExist:
         user = User(username=username, password=UNUSABLE_PASSWORD)
         user.save()
     try:
         srpinfo = SRPUserInfo.objects.get(user=user)
     except SRPUserInfo.DoesNotExist:
         srpinfo = SRPUserInfo(user=user)
     srpinfo.set_from_password(password)
     srpinfo.save()
Пример #4
0
 def handle(self, *args, **options):
     if len(args) != 2:
         raise CommandError("must specify username and password")
     username = args[0]
     password = args[1]
     try:
         user = User.objects.get(username=username)
     except User.DoesNotExist:
         user = User(username=username, password=UNUSABLE_PASSWORD)
         user.save()
     try:
         srpinfo = SRPUserInfo.objects.get(user=user)
     except SRPUserInfo.DoesNotExist:
         srpinfo = SRPUserInfo(user=user)
     srpinfo.set_from_password(password)
     srpinfo.save()