We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2dfc983 commit a6509c2Copy full SHA for a6509c2
app/models/ombu_labs/auth/user.rb
@@ -1,9 +1,20 @@
1
module OmbuLabs::Auth
2
class User < ApplicationRecord
3
+ self.table_name = "users"
4
+
5
# Include default devise modules. Others available are:
6
# :confirmable, :lockable, :timeoutable
7
devise :database_authenticatable, :registerable,
- :recoverable, :rememberable, :trackable,
- :validatable, :omniauthable
8
+ :recoverable, :rememberable, :trackable,
9
+ :validatable, :omniauthable
10
11
+ def self.from_omniauth(auth)
12
+ user_attributes = {
13
+ email: auth.info.email,
14
+ name: auth.info.name,
15
+ password: Devise.friendly_token[0, 20]
16
+ }
17
+ where(provider: auth.provider, uid: auth.uid).first_or_create.tap { |user| user.update(user_attributes) }
18
+ end
19
end
20
0 commit comments