thanks for the reply, here is the code I have so far.
class InvitationsController < Devise::InvitationsController
def create
@content = "test"
@user = User.invite!(email: params[:user]) do |u|
u.skip_invitation = true
end
NotificationMailer.invite_message(@user, @from, @subject, @content).deliver
@user.invitation_sent_at = Time.now.utc # mark invitation as delivered
if @user.errors.empty?
flash[:notice] = "successfully sent invite to #{@user.email}"
render json: @user #, :location => root_path
else
render :new
end
end
def after_accept_path_for
end
end
class NotificationMailer < ActionMailer::Base
def invite_message(user, from, subject, content)
@user = user
@token = user.raw_invitation_token
invitation_link = accept_user_invitation_url(:invitation_token => @token)
mail(:from => from, :bcc => from, :to => @user.email, :subject => subject, template_path: 'mailers/notification_mailer') do |format|
content = content.gsub('{{invitation_link}}', invitation_link)
format.text do
render :text => content
end
end
end
end
invitaiton_instructions.html.erb:
<p><%= I18n.t("devise.mailer.invitation_instructions.hello", email: @resource.email) %></p>
<p><%= link_to I18n.t("devise.mailer.invitation_instructions.accept"), accept_invitation_url("
www.mypartnerswebsite.com", :invitation_token => @token) %></p>
<p><%= I18n.t("devise.mailer.invitation_instructions.ignore").html_safe %></p>
I have filled in certain parts of the code with the issue at hand by labeling them "
mywebsite.com" and "
mypartnerswebsite.com". I have json only api endpoints set up that my partner hits form another domain address. The email's are set up on my end, and right now we are trying to configure admins to invite users through devise invitable. The problem is that whenever I try to override the accept_invitation_url and change it to "
www.mypartnerswebsite.com", i cant seem to get it to work. I am trying to get the redirect on accepting the invite to look like this:
after submitting an email address to my invitation controller, it attempts to reroute to GET "/users/sign_in" through my routes, so no real error response at this point, but I dont know how to get from here to redirecting to http://
mypartnerswebsite.com/users/sign_in/. any ideas if this is possible and how to do it?
I have tried changing the host url in regards to the actionmailer views guide, but have been unable to get the correct response in order to redirect to
www.mypartnerswebsite.com. thanks again for the response.