Created
November 29, 2012 10:49
-
-
Save brutasse/4168160 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.hashers import BasePasswordHasher | |
class NotHashingHasher(BasePasswordHasher): | |
""" | |
A hasher that does not hash. | |
""" | |
algorithm = 'plain' | |
def encode(self, password, salt): | |
return '{0}${1}'.format(self.algorithm, password) | |
def salt(self): | |
return None | |
def verify(self, password, encoded): | |
algo, decoded = encoded.split('$', 1) | |
return password == decoded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment