Google authentication added

This commit is contained in:
Christoph Haas 2017-04-17 00:42:03 +02:00
parent f7258370a0
commit 2a7491edcd
7 changed files with 37 additions and 28 deletions

View file

@ -10,7 +10,11 @@ class User < ApplicationRecord
# :validatable,
:timeoutable,
# :lockable,
:omniauthable, :omniauth_providers => [:launchpad,:stackexchange]
:omniauthable, :omniauth_providers => [
:launchpad,
:stackexchange,
:google_oauth2
]
def self.from_omniauth(auth)
@ -23,19 +27,5 @@ class User < ApplicationRecord
user.password = Devise.friendly_token[0,20]
end
end
#
# def self.from_omniauth(access_token)
# data = access_token.info
# user = User.where(:email => data["email"]).first
#
# # Uncomment the section below if you want users to be created if they don't exist
# # unless user
# # user = User.create(name: data["name"],
# # email: data["email"],
# # password: Devise.friendly_token[0,20]
# # )
# # end
# user
# end
end