FIX: In the case of a blank name, use a SHA1

This commit is contained in:
Robin Ward 2017-01-19 14:31:35 -05:00
parent b741adb364
commit 4ed46a45ed

View File

@ -28,7 +28,13 @@ class ImportScripts::JsonGeneric < ImportScripts::Base
end
def username_for(name)
name.downcase.gsub(/[^a-z0-9\-\_]/, '')
result = name.downcase.gsub(/[^a-z0-9\-\_]/, '')
if result.blank?
result = Digest::SHA1.hexdigest(name)[0...10]
end
result
end
def import_users