nejdetkadir / devise-api

The devise-api gem is a convenient way to add authentication to your Ruby on Rails application using the devise gem. It provides support for access tokens and refresh tokens, which allow you to authenticate API requests and keep the user's session active for a longer period of time on the client side
MIT License
152 stars 22 forks source link

Confirmation email redirect to a certain host #37

Open prp-e opened 7 months ago

prp-e commented 7 months ago

Greetings.

I implemented devise's email confirmation on my app, which is an api only app and I also use devise-api in order to bring it to life. The problem is when I confirm the account, it goes to localhost:3001/users/sing_in which is not there. I just want it to send my user back to the index page of my site. I am using this method:

class ConfirmationsController < Devise::ConfirmationsController

    def new
        super
      end

      def create
        super
      end

      def show
        self.resource = resource_class.confirm_by_token(params[:confirmation_token])

        if resource.errors.empty?
          set_flash_message(:notice, :confirmed) if is_navigational_format?
          sign_in(resource_name, resource)
          respond_with_navigational(resource){ redirect_to('https://example.com/page', allow_other_host: true) }
        else
          false
        end
      end

end

But as I said earlier, it goes to /users/sign_in to my app which does not exist.