mirror of
https://github.com/docusealco/docuseal
synced 2026-11-05 22:52:32 -05:00
add MS oauth
This commit is contained in:
1 parent
83ce401cf2
commit
9f48c6e625
8 files changed
+62
-15
No files matched your search
+13
-4
@@ -4,12 +4,21 @@ module Users
|
||||
module_function
|
||||
|
||||
def from_omniauth(oauth)
|
||||
user = User.find_by(email: oauth.info.email)
|
||||
user = User.find_by(email: oauth.info.email.to_s.downcase)
|
||||
|
||||
return user if user
|
||||
|
||||
User.new(email: oauth.info.email,
|
||||
first_name: oauth.extra.id_info.given_name,
|
||||
last_name: oauth.extra.id_info.family_name)
|
||||
case oauth['provider'].to_s
|
||||
when 'google_oauth2'
|
||||
User.new(email: oauth.info.email,
|
||||
first_name: oauth.extra.id_info.given_name,
|
||||
last_name: oauth.extra.id_info.family_name)
|
||||
when 'microsoft_office365'
|
||||
User.new(email: oauth.info.email,
|
||||
first_name: oauth.info.first_name,
|
||||
last_name: oauth.info.last_name)
|
||||
when 'github'
|
||||
User.new(email: oauth.info.email, first_name: oauth.info.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user