Guest User

Untitled

a guest
Jul 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. class User < ActiveRecord::Base
  2. # Include default devise modules. Others available are:
  3. # :token_authenticatable, :confirmable, :lockable and :timeoutable
  4. devise :database_authenticatable, :omniauthable, :registerable,
  5. :recoverable, :rememberable, :trackable, :validatable
  6.  
  7. # Setup accessible (or protected) attributes for your model
  8. attr_accessible :email, :password, :password_confirmation, :remember_me
  9.  
  10. def self.find_for_google_apps_oauth(access_token, signed_in_resource=nil)
  11. data = access_token['extra'],['user_hash']
  12. if user = User.find_by_email(data["email"])
  13. user
  14. else # Create a user with a stub password
  15. User.create!(:email => data["email"], :password => Devise.friendly_token[0,20])
  16. end
  17. end
  18. end
Add Comment
Please, Sign In to add comment