1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/test/rails_app/lib/shared_user.rb

27 lines
734 B
Ruby
Raw Normal View History

2010-07-16 11:01:36 +02:00
module SharedUser
extend ActiveSupport::Concern
included do
devise :database_authenticatable, :confirmable, :lockable, :recoverable,
:registerable, :rememberable, :timeoutable, :token_authenticatable,
2010-10-14 23:46:10 +02:00
:trackable, :validatable, :omniauthable
2010-07-16 11:01:36 +02:00
attr_accessor :other_key
attr_accessible :username, :email, :password, :password_confirmation, :remember_me
2010-07-16 11:01:36 +02:00
# They need to be included after Devise is called.
extend ExtendMethods
end
module ExtendMethods
def new_with_session(params, session)
super.tap do |user|
2010-10-14 23:46:10 +02:00
if data = session["devise.facebook_data"]
2010-10-15 00:44:21 +02:00
user.email = data["email"]
user.confirmed_at = Time.now
2010-07-16 11:01:36 +02:00
end
end
end
end
end