<%= t('mailer.common.hi', name: @resource.name) %>,

<% account_user = @resource&.account_users&.first %> <% brand_name = global_config['BRAND_NAME'] || 'Chatwoot' %> <% if account_user&.inviter.present? && @resource.unconfirmed_email.blank? %>

<%= t('mailer.devise.confirmation_instructions.invited_html', inviter_name: account_user.inviter.name, account_name: account_user.account.name, brand_name: brand_name) %>

<% end %> <% if @resource.confirmed? %>

<%= t('mailer.devise.confirmation_instructions.login_message_html', brand_name: brand_name) %>

<% else %> <% if account_user&.inviter.blank? %>

<%= t('mailer.devise.confirmation_instructions.welcome_html', brand_name: brand_name) %>

<% end %>

<%= t('mailer.devise.confirmation_instructions.activate_html') %>

<% end %> <% if @resource.unconfirmed_email.present? %>

<%= link_to t('mailer.devise.confirmation_instructions.confirm_account'), frontend_url('auth/confirmation', confirmation_token: @token) %>

<% elsif @resource.confirmed? %>

<%= link_to t('mailer.devise.confirmation_instructions.login_account'), frontend_url('auth/sign_in') %>

<% elsif account_user&.inviter.present? %>

<%= link_to t('mailer.devise.confirmation_instructions.confirm_account'), frontend_url('auth/password/edit', reset_password_token: @resource.send(:set_reset_password_token)) %>

<% else %>

<%= link_to t('mailer.devise.confirmation_instructions.confirm_account'), frontend_url('auth/confirmation', confirmation_token: @token) %>

<% end %>