Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple of Devise bug fixes #84

Merged
merged 2 commits into from
May 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/controllers/omniauth_callbacks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

class OmniauthCallbacksController < Devise::OmniauthCallbacksController
extend T::Sig
include Devise::Controllers::Rememberable

# skip_before_action :authenticate_user!, raise: false
skip_before_action :verify_authenticity_token, only: :google_oauth2
Expand All @@ -12,6 +13,8 @@ def google_oauth2
auth = request.env["omniauth.auth"]
user = User.from_omniauth(auth, referral_code: cookies[:referral_code])

remember_me(user)

if user.persisted?
flash[:success] = "Successfully logged in! Welcome to Hotseat!"
sign_in_and_redirect(user)
Expand Down
4 changes: 2 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
}

devise_scope :user do
get "sign_in", to: "sessions#new", as: :new_user_session
delete "sign_out", to: "sessions#destroy", as: :destroy_user_session
get "sign_in", to: "devise/sessions#new", as: :new_user_session
delete "sign_out", to: "devise/sessions#destroy", as: :destroy_user_session
end

mount Ahoy::Engine => "/hotcount"
Expand Down
Loading