diff --git a/server/app/mailers/devise_mailer.rb b/server/app/mailers/devise_mailer.rb index 4f9f415f..80870b80 100644 --- a/server/app/mailers/devise_mailer.rb +++ b/server/app/mailers/devise_mailer.rb @@ -6,6 +6,7 @@ class DeviseMailer < Devise::Mailer def invitation_instructions(record, token, opts = {}) @workspace = opts[:workspace] @role = opts[:role] + @is_verified = opts[:is_verified] || false @token = token super end diff --git a/server/app/views/devise/mailer/invitation_instructions.html.erb b/server/app/views/devise/mailer/invitation_instructions.html.erb index 06a8630a..16b7ebf3 100644 --- a/server/app/views/devise/mailer/invitation_instructions.html.erb +++ b/server/app/views/devise/mailer/invitation_instructions.html.erb @@ -60,7 +60,7 @@ <%= "#{@resource.invited_by.name} has invited you to use AI Squared with them, in a workspace called #{@workspace.name}." %>
<% query_params = { invited: true, invited_user:@resource.email, invitation_token: @token, workspace_id: @workspace.id, workspace_name: @workspace.name, invited_by: @resource.invited_by.name } %> - <% custom_url = "#{ENV['UI_HOST']}/sign-up?#{query_params.to_query}" %> + <% custom_url = @is_verified ? "#{ENV['UI_HOST']}/sign-in" : "#{ENV['UI_HOST']}/sign-up?#{query_params.to_query}" %> - <% if @resource.invitation_due_at %> + <% if !@is_verified && @resource.invitation_due_at %><%= t("devise.mailer.invitation_instructions.accept_until", due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')) %>
<% end %>