Skip to content

Instantly share code, notes, and snippets.

@cyx
Created December 6, 2009 19:42
Show Gist options
  • Save cyx/250371 to your computer and use it in GitHub Desktop.
Save cyx/250371 to your computer and use it in GitHub Desktop.
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