Google authentication added
This commit is contained in:
parent
f7258370a0
commit
2a7491edcd
7 changed files with 37 additions and 28 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue