I working on a app with Rails 6, React Devise & GraphQl & devise-token_authenticatable for authentication.
I'm trying to confirm the user after they successfully confirm their email. After searching and finding some possible answers I have tried this: in devise>> confirmation_controller.rb
class Devise::ConfirmationsController < DeviseController
protected
# The path used after confirmation.
def after_confirmation_path_for(resource_name, resource)
if signed_in?(resource_name)
redirect_to app_root_url
else
resource.confirm!
redirect_to "#{request.base_url}/app/login", notice: "Email confirmed!"
end
end
end
But this doesn't work as expected.
I also tried the following without any luck:
def after_confirmation
self.confirm!
end
Any suggestions? Thanks for your time
Ok, I figured it out finally. Here's my solution. I just updated the users
confirmed_atattribute inUsers::ConfirmationsController#showaction.In routes.rb
devise_for :users, skip: :sessions, controllers: { confirmations: 'users/confirmations' }