lib/devise_russian/models/base.rb in devise_russian-0.0.13 vs lib/devise_russian/models/base.rb in devise_russian-0.0.21
- old
+ new
@@ -7,10 +7,15 @@
end
module ClassMethods
def omniauthable
has_many :authentications, :dependent => :destroy
+
+ def ommiauth_enabled
+ true
+ end
+
unless included_modules.include? InstanceMethods
include InstanceMethods
end
end
end
@@ -20,21 +25,15 @@
provider = omniauth['provider']
uid = omniauth['uid']
user_email = omniauth['extra']['raw_info']['email'] rescue nil
user_name = omniauth['extra']['raw_info']['first_name'] rescue nil
- # Facebook omniauth: #<OmniAuth::AuthHash credentials=#<Hashie::Mash expires=true expires_at=1368497603 token="AAAHyrzX1f8gBAEZBgtqQZCcLHgRDMbioJ6cltTxqTd3qlnvY1JXAtOivUKu8DzVfKf3f2x7ZCbZAF6qciuww2qVGVrFq6yoVxwZCHPZCn0HgZDZD"> extra=#<Hashie::Mash raw_info=#<Hashie::Mash email="lapida@ya.ru" first_name="Lipada" gender="male" hometown=#<Hashie::Mash id="111803002172556" name="Tomsk, Russia"> id="100005327070305" last_name="Ru" link="http://www.facebook.com/profile.php?id=100005327070305" locale="ru_RU" name="Lipada Ru" timezone=7 updated_time="2013-02-20T15:25:45+0000" verified=true>> info=#<OmniAuth::AuthHash::InfoHash email="lapida@ya.ru" first_name="Lipada" image="http://graph.facebook.com/100005327070305/picture?type=square" last_name="Ru" name="Lipada Ru" urls=#<Hashie::Mash Facebook="http://www.facebook.com/profile.php?id=100005327070305"> verified=true> provider="facebook" uid="100005327070305">
-
- # Vkontakte omniauth: #<OmniAuth::AuthHash credentials=#<Hashie::Mash expires=true expires_at=1363456283 token="46de998d8c438603e0d92af694d47744260b89f1e493ffa2403c41ca98aaf9a26aae375a384e0817711c5"> extra=#<Hashie::Mash raw_info=#<Hashie::Mash city="144" country="1" first_name="Lipada" last_name="Ru" nickname="" online=0 photo="https://vk.com/images/camera_c.gif" photo_big="https://vk.com/images/camera_a.gif" screen_name="id201853841" sex=2 uid=201853841>> info=#<OmniAuth::AuthHash::InfoHash first_name="Lipada" image="https://vk.com/images/camera_c.gif" last_name="Ru" location="Россия, Томск" name="Lipada Ru" nickname="" urls=#<Hashie::Mash Vkontakte="http://vk.com/id201853841">> provider="vkontakte" uid=201853841>
-
- # Odnoklassniki omniauth: #<OmniAuth::AuthHash credentials=#<Hashie::Mash expires=false token="2aipa.2-71160004l6v6h3r406y3k6bsrv9"> extra=#<Hashie::Mash raw_info=#<Hashie::Mash age=25 birthday="1987-07-14" first_name="Lipada" gender="male" has_email=true last_name="ru" locale="ru" location=#<Hashie::Mash city="Томск" country="RUSSIAN_FEDERATION"> name="Lipada ru" online="web" pic_1="http://i503.odnoklassniki.ru/res/stub_50x50.gif" pic_2="http://usd8.odnoklassniki.ru/res/stub_128x96.gif" uid="555839750549">> info=#<OmniAuth::AuthHash::InfoHash first_name="Lipada" image="http://i503.odnoklassniki.ru/res/stub_50x50.gif" last_name="ru" name="Lipada ru" urls=#<Hashie::Mash Odnoklassniki="http://www.odnoklassniki.ru/profile/555839750549">> provider="odnoklassniki" uid="555839750549">
-
if with_self
self.email = user_email if user_email && self.email.blank?
self.name = user_name if user_name && self.name.blank?
end
- self.authentications.build(
+ self.authentications.new(
:provider => provider,
:uid => uid,
:email => user_email,
:name => user_name
)