Commits

Simon Law  committed 6dc5f6b

Docstrings.

  • Participants
  • Parent commits a3116ac

Comments (0)

Files changed (1)

File django_bcrypt/models.py

+"""
+Overrides :class:`django.contrib.auth.models.User` to use bcrypt
+hashing for passwords.
+"""
+
+
 import bcrypt
 
 from django.contrib.auth.models import User
 
 
 def bcrypt_check_password(self, raw_password):
+    """
+    Returns a boolean of whether the *raw_password* was correct.
+
+    Attempts to validate with bcrypt, but falls back to Django's
+    ``User.check_password()`` if the hash is incorrect.
+    """
     if self.password.startswith('bc$'):
         salt_and_hash = self.password[3:]
         return bcrypt.hashpw(raw_password, salt_and_hash) == salt_and_hash
 
 
 def bcrypt_set_password(self, raw_password):
+    """
+    Sets the user's password to *raw_password*, hashed with bcrypt.
+    """
     if raw_password is None:
         self.set_unusable_password()
     else: