Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def self.create_from_hash(registration_hash)
- unless registration_hash || resigration_hash.empty?
- return nil
- end
- provider = registration_hash[:provider]
- info = registration_hash[:info]
- user = User.new
- if info.password
- user.password = info.password
- else
- user.password = Devise.friendly_token[0,20]
- end
- user.password_confirmation = user.password
- if provider == "seznam" || provider == "open_id"
- user.email = info.nickname
- else
- user.email = info.email
- end
- # if data.first_name && info.last_name
- # user.first_name = info.first_name if user.first_name.blank?
- # user.last_name = info.last_name if user.last_name.blank?
- # elsif data.name
- # user.full_name = info.name if user.full_name.blank?
- # user.first_name = info.name.split(' ')[0] if user.first_name.blank?
- # user.last_name = info.name.split(' ')[1] if user.last_name.blank?
- # end
- # twitter: čtverec 48x48; odstranit "_normal" ze stringu pro plnou velikost obrázku
- # facebook: čtverec 50x50; dál už se s tím nic nedá dělat
- # user.image = info.image if user.image.blank?
- # user.gender = registration_hash['extra']['gender'] if user.gender.blank?
- if registration_hash[:skip_confirmation] == true
- # user.confirm!
- end
- user
- end
Add Comment
Please, Sign In to add comment