remove password constraints

This commit is contained in:
Harry Bomrah 2017-05-24 17:12:33 +08:00
parent 9ffdccdd97
commit f91e703dab
2 changed files with 6 additions and 5 deletions

View File

@ -34,7 +34,7 @@ class HpsMember
has_secure_password has_secure_password
validates :account, uniqueness: true validates :account, uniqueness: true
validates :password, :on => [:create], length: {:in => 8..20} validates :password, :on => [:create]
has_many :hps_files, :dependent => :destroy has_many :hps_files, :dependent => :destroy

View File

@ -56,9 +56,10 @@ namespace :hps_task do
users = JSON.parse(data) users = JSON.parse(data)
users.each do |user| users.each do |user|
hpsm = HpsMember.where(:old_id => user["old_id"]).first rescue nil hpsm = HpsMember.where(:old_id => user["old_id"]).first rescue nil
if !hpsm.nil? if hpsm.nil?
hpsm = HpsMember.new hpsm = HpsMember.new
end end
puts "Createing acccount #{user["account"]}"
hpsm.old_id = user["old_id"] hpsm.old_id = user["old_id"]
hpsm.account = user["account"] hpsm.account = user["account"]
hpsm.password = user["password"] hpsm.password = user["password"]
@ -69,11 +70,11 @@ namespace :hps_task do
hpsm.address = user["address"] hpsm.address = user["address"]
hpsm.title = user["title"] hpsm.title = user["title"]
school = HpsSchool.where(:old_id => user["SchoolID"]).first school = HpsSchool.where(:old_id => user["SchoolID"]).first
hpsm.hps_school_id = school.id.to_s hpsm.hps_school_id = school.id.to_s if !school.nil?
city = HpsCity.where(:old_id => user["my_county"]).first city = HpsCity.where(:old_id => user["my_county"]).first
hpsm.hps_city_id = city.id.to_s hpsm.hps_city_id = city.id.to_s if !city.nil?
county = HpsCounty.where(:old_id => user["cityzip"]).first county = HpsCounty.where(:old_id => user["cityzip"]).first
hpsm.hps_county_id = county.id.to_s hpsm.hps_county_id = county.id.to_s if !county.nil?
hpsm.save hpsm.save
end end
end end