Dineshkumar
Dineshkumar

Reputation: 4245

devise_invitable customize invite link

I'm using devise_invitable for inviting users through mail. when users follow the link it redirects to set password page which i don't want.

How to send an invitation with a link to my customized page?

i tried overriding controller

class InvitationsController < Devise::InvitationsController

added views via generate. [i can edit invitation page] devise/mailer/invitation_instructions.

accept_invitation_url(@resource, :invitation_token => @token)

modified devise.rb to include my controller. but my controller is not used and it uses devise's controller.

devise_for :candidates, :controller => {:invitations => 'invitations'} 

I want this to be customized link. How to change the flow and override controller?

Upvotes: 0

Views: 1110

Answers (2)

Yogesh Khater
Yogesh Khater

Reputation: 1958

If you want to redirect your invitee to your custom page, you can specify it by overriding after_invite_path_for(resource)

Upvotes: 1

Maksim Gladkov
Maksim Gladkov

Reputation: 3079

Are you using devise_invitable gem?

If so, I think it uses custom code to include routes and you need to add your modified routes before devise.

resource :invitation, only: [:new, :create], path: '...', controller: '...'

You can refer to this file to get some ideas on how to override routes: https://github.com/scambra/devise_invitable/blob/master/lib/devise_invitable/routes.rb

Hope it helps!

Upvotes: 0

Related Questions