Created
December 6, 2009 19:42
-
-
Save cyx/250371 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
class User | |
module DeprecatedPasswordCheck | |
def valid_password?( attempted_password, check_against_database = check_passwords_against_database? ) | |
if valid_legacy_password?( attempted_password ) | |
return true | |
else | |
super | |
end | |
end | |
private | |
def valid_legacy_password?( attempted_password ) | |
crypted_password == encrypted_legacy_password( attempted_password ) | |
end | |
def encrypted_legacy_password( attempted_password ) | |
Digest::SHA1.hexdigest("--#{attempted_password}--#{password_salt}--") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment