diff --git a/plugin.rb b/plugin.rb index 92527d4..b5b487a 100644 --- a/plugin.rb +++ b/plugin.rb @@ -105,15 +105,7 @@ after_initialize do end def self.check_all(password, crypted_pass) - AlternativePassword::check_vbulletin(password, crypted_pass) || - AlternativePassword::check_vbulletin5(password, crypted_pass) || - AlternativePassword::check_ipb(password, crypted_pass) || - AlternativePassword::check_smf(password, crypted_pass) || - AlternativePassword::check_md5(password, crypted_pass) || - AlternativePassword::check_wordpress(password, crypted_pass) || - AlternativePassword::check_bcrypt(password, crypted_pass) || - AlternativePassword::check_sha256(password, crypted_pass) || - AlternativePassword::check_wbblite(password, crypted_pass) + AlternativePassword::check_smf_bcrypt(password, crypted_pass) end def self.check_bcrypt(password, crypted_pass) @@ -150,6 +142,17 @@ after_initialize do hash == sha1.hexdigest end + def self.check_smf_bcrypt(password, crypted_pass) + user, hash = crypted_pass.split(':', 2) + sha1 = Digest::SHA1.new + sha1.update user + password + begin + BCrypt::Password.new(hash) == sha1.hexdigest + rescue + false + end + end + def self.check_ipb(password, crypted_pass) salt, hash = crypted_pass.split(':', 2) !salt.nil? && hash == Digest::MD5.hexdigest(Digest::MD5.hexdigest(salt) + Digest::MD5.hexdigest(password))