mirror of
https://github.com/moparisthebest/discourse-migratepassword
synced 2024-11-21 16:35:02 -05:00
Added exception handler for BCrypt
This commit is contained in:
parent
e64e2f5368
commit
57c2c06c7a
@ -1,6 +1,6 @@
|
||||
# name: discourse-migratepassword
|
||||
# about: enable alternative password hashes
|
||||
# version: 0.6
|
||||
# version: 0.6a
|
||||
# authors: Jens Maier and Michael@discoursehosting.com
|
||||
|
||||
# uses phpass-ruby https://github.com/uu59/phpass-ruby
|
||||
@ -132,7 +132,11 @@ after_initialize do
|
||||
def self.check_vbulletin5(password, crypted_pass)
|
||||
# replace $2y$ with $2a$ see http://stackoverflow.com/a/20981781
|
||||
crypted_pass.gsub! /^\$2y\$/, '$2a$'
|
||||
BCrypt::Password.new(crypted_pass) == Digest::MD5.hexdigest(password)
|
||||
begin
|
||||
BCrypt::Password.new(crypted_pass) == Digest::MD5.hexdigest(password)
|
||||
rescue
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def self.check_md5(password, crypted_pass)
|
||||
|
Loading…
Reference in New Issue
Block a user