|
1 | 1 | # name: discourse-migratepassword
|
2 | 2 | # about: enable alternative password hashes
|
3 |
| -# version: 0.71 |
4 |
| -# authors: Jens Maier and Michael@discoursehosting.com |
| 3 | +# version: 0.8 |
| 4 | +# authors: Jens Maier and michael@communiteq.com |
5 | 5 | # url: https://github.com/discoursehosting/discourse-migratepassword
|
6 | 6 |
|
7 | 7 | # Usage:
|
|
25 | 25 | gem 'bcrypt', '3.1.3'
|
26 | 26 | gem 'unix-crypt', '1.3.0', :require_name => 'unix_crypt'
|
27 | 27 |
|
| 28 | +gem 'ffi', '1.15.5', require: false |
| 29 | +gem 'ffi-compiler', '1.0.1', require: false |
| 30 | +gem 'argon2', '2.1.1' |
| 31 | + |
28 | 32 | enabled_site_setting :migratepassword_enabled
|
29 | 33 |
|
30 | 34 | require 'digest'
|
@@ -237,7 +241,17 @@ def self.check_all(password, crypted_pass)
|
237 | 241 | AlternativePassword::check_joomla_3_2(password, crypted_pass) ||
|
238 | 242 | AlternativePassword::check_q2a(password, crypted_pass) ||
|
239 | 243 | AlternativePassword::check_drupal7(password, crypted_pass) ||
|
240 |
| - AlternativePassword::check_devise(password, crypted_pass) |
| 244 | + AlternativePassword::check_devise(password, crypted_pass) || |
| 245 | + AlternativePassword::check_argon(password, crypted_pass) |
| 246 | + end |
| 247 | + |
| 248 | + def self.check_argon(password, crypted_pass) |
| 249 | + begin |
| 250 | + return false unless crypted_pass[0..9] == '$argon2id$' |
| 251 | + return Argon2::Password.verify_password(password, crypted_pass) |
| 252 | + rescue |
| 253 | + false |
| 254 | + end |
241 | 255 | end
|
242 | 256 |
|
243 | 257 | def self.check_devise(password, crypted_pass)
|
|
0 commit comments