devise-api icon indicating copy to clipboard operation
devise-api copied to clipboard

Confirmation email redirect to a certain host

Open prp-e opened this issue 1 year ago • 0 comments

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.

prp-e avatar Dec 29 '23 18:12 prp-e