mirror of
https://github.com/moparisthebest/discourse-migratepassword
synced 2024-11-21 08:25:08 -05:00
Added wbblite doublesalted
This commit is contained in:
parent
2ee8561012
commit
d740c00c65
12
plugin.rb
12
plugin.rb
@ -12,6 +12,7 @@
|
||||
# for Phorum #{password} md5(pass)
|
||||
# for Wordpress #{password} phpass(8).crypt(pass)
|
||||
# for SMF #{username}:#{password} sha1(user+pass)
|
||||
# for WBBlite #{salt}:#{hash} sha1(salt+sha1(salt+sha1(pass)))
|
||||
|
||||
gem 'bcrypt', '3.1.3'
|
||||
|
||||
@ -109,7 +110,8 @@ after_initialize do
|
||||
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_sha256(password, crypted_pass) ||
|
||||
AlternativePassword::check_wbblite(password, crypted_pass)
|
||||
end
|
||||
|
||||
def self.check_bcrypt(password, crypted_pass)
|
||||
@ -150,7 +152,13 @@ after_initialize do
|
||||
sha256 = Digest::SHA256.new
|
||||
sha256.update password
|
||||
crypted_pass == sha256.hexdigest
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_wbblite(password, crypted_pass)
|
||||
salt, hash = crypted_pass.split(':', 2)
|
||||
sha1 = Digest::SHA1.hexdigest(salt + Digest::SHA1.hexdigest(salt + Digest::SHA1.hexdigest(password)))
|
||||
hash == sha1
|
||||
end
|
||||
end
|
||||
|
||||
class ::User
|
||||
|
Loading…
Reference in New Issue
Block a user