Adds support for importing password hashes used by "migratepassword" plugin

Adds setting to phpBB3 importer for importing passwords (default: off)
Plugin: https://github.com/discoursehosting/discourse-migratepassword
This commit is contained in:
Gerhard Schlager
2015-08-20 22:15:57 +02:00
parent 676416f478
commit 8c03dd16af
6 changed files with 15 additions and 2 deletions

View File

@ -273,6 +273,7 @@ class ImportScripts::Base
u.custom_fields["import_id"] = import_id
u.custom_fields["import_username"] = opts[:username] if opts[:username].present?
u.custom_fields["import_avatar_url"] = avatar_url if avatar_url.present?
u.custom_fields["import_pass"] = opts[:password] if opts[:password].present?
begin
User.transaction do
@ -284,6 +285,10 @@ class ImportScripts::Base
u.user_profile.save!
end
end
if opts[:active] && opts[:password].present?
u.activate
end
rescue
# try based on email
existing = User.find_by(email: opts[:email].downcase)