improve registration and add oauth

This commit is contained in:
Alex Turchyn
2023-07-14 22:33:42 +03:00
parent f7ef99a624
commit 6f3fe1dd7b
20 changed files with 170 additions and 23 deletions
+15
View File
@@ -0,0 +1,15 @@
# frozen_string_literal: true
module Users
module_function
def from_omniauth(oauth)
user = User.find_by(email: oauth.info.email)
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)
end
end