diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb new file mode 100644 index 00000000..8d9b3511 --- /dev/null +++ b/app/controllers/profiles_controller.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class ProfilesController < ApplicationController + include EventRouting + + def show; end +end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 98578400..194846b0 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,13 +1,21 @@ # frozen_string_literal: true class SessionsController < ApplicationController - skip_before_action :set_user skip_before_action :set_plan skip_before_action :set_locale skip_before_action :set_last_path def create + create_and_set_user unless @user + user_info = request.env['omniauth.auth'] + @user.create_profile( + provider: user_info['provider'], + uid: user_info['uid'], + name: user_info['info']['name'], + email: user_info['info']['email'], + avatar_url: user_info['info']['image'] + ) redirect_to session[:last_path] end end diff --git a/app/helpers/profiles_helper.rb b/app/helpers/profiles_helper.rb new file mode 100644 index 00000000..9ba602e9 --- /dev/null +++ b/app/helpers/profiles_helper.rb @@ -0,0 +1,4 @@ +# frozen_string_literal: true + +module ProfilesHelper +end diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 43bc2363..b736f80e 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -64,6 +64,15 @@ <%= I18n.t('nav.plan') %> <% end %> +
  • + + > + + <%= I18n.t('nav.profile') %> +