Example #1
0
 def check_password(self, raw_password):
     """
     Returns a boolean of whether the raw_password was correct. Handles
     encryption formats behind the scenes.
     """
     # Backwards-compatibility check. Older passwords won't include the
     # algorithm or salt.
     if '$' not in self.password:
         is_correct = (self.password == get_hexdigest('md5', '', raw_password))
         if is_correct:
             # Convert the password to the new, more secure format.
             self.set_password(raw_password)
             self.save()
         return is_correct
     return check_password(raw_password, self.password)
Example #2
0
 def check_password(self, raw_password):
     """
     Returns a boolean of whether the raw_password was correct. Handles
     encryption formats behind the scenes.
     """
     # Backwards-compatibility check. Older passwords won't include the
     # algorithm or salt.
     if '$' not in self.password:
         is_correct = (self.password == get_hexdigest(
             'md5', '', raw_password))
         if is_correct:
             # Convert the password to the new, more secure format.
             self.set_password(raw_password)
             self.save()
         return is_correct
     return check_password(raw_password, self.password)
Example #3
0
 def check_password(self, raw_password):
     """
     Returns a boolean of whether the raw_password was correct. Handles
     encryption formats behind the scenes.
     """
     return check_password(raw_password, self.password)
Example #4
0
 def test_make_unusable(self):
     "Check that you can create an unusable password."
     password = utils.make_password("any", None)
     self.assertFalse(utils.is_password_usable(password))
     self.assertFalse(utils.check_password("foobar", password))
Example #5
0
 def _test_make_password(self, algo):
     password = utils.make_password(algo, "foobar")
     self.assertTrue(utils.is_password_usable(password))
     self.assertTrue(utils.check_password("foobar", password))
Example #6
0
 def check_password(self, raw_password):
     """
     Returns a boolean of whether the raw_password was correct. Handles
     encryption formats behind the scenes.
     """
     return check_password(raw_password, self.password)
Example #7
0
 def check_password(self, raw_password):
     return check_password(raw_password, self.password)
Example #8
0
 def test_make_unusable(self):
     "Check that you can create an unusable password."
     password = utils.make_password("any", None)
     self.assertFalse(utils.is_password_usable(password))
     self.assertFalse(utils.check_password("foobar", password))
Example #9
0
 def _test_make_password(self, algo):
     password = utils.make_password(algo, "foobar")
     self.assertTrue(utils.is_password_usable(password))
     self.assertTrue(utils.check_password("foobar", password))