Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class User < ActiveRecord::Base
- # Include default devise modules. Others available are:
- # :token_authenticatable, :confirmable, :lockable and :timeoutable
- devise :database_authenticatable, :omniauthable, :registerable,
- :recoverable, :rememberable, :trackable, :validatable
- # Setup accessible (or protected) attributes for your model
- attr_accessible :email, :password, :password_confirmation, :remember_me
- def self.find_for_google_apps_oauth(access_token, signed_in_resource=nil)
- data = access_token['extra'],['user_hash']
- if user = User.find_by_email(data["email"])
- user
- else # Create a user with a stub password
- User.create!(:email => data["email"], :password => Devise.friendly_token[0,20])
- end
- end
- end
Add Comment
Please, Sign In to add comment