<% content_for :title, t(".invitation") %>

<%= t(".youre_invited") %>

<%= t(".invited_by_html", who: (@invitation.created_by&.display_name || t(".an_administrator")), label: @invitation.label) %>

<%= render "joins/grants", invitation: @invitation %>
<%= link_to t(".i_have_an_account"), new_session_path, class: "btn-primary w-full justify-center" %> <% if @invitation.email %>

<%= t(".for_email", email: @invitation.email) %>

<% end %>
<% if Sso.password_login? && !(@invitation.email && User.exists?(email_address: @invitation.email)) %> <%= form_with url: account_join_path(params[:token]), class: "card card-body space-y-3" do %>

<%= t(".or_create_an_account") %>

<% if @account_errors.present? %><% end %> <% if @invitation.email %>
<% else %>
<%= label_tag :email_address, t(".email"), class: "label" %><%= email_field_tag :email_address, params[:email_address], class: "input", required: true, autocomplete: "username" %>
<% end %>
<%= label_tag :name, t(".your_name"), class: "label" %><%= text_field_tag :name, params[:name] || @invitation.name, class: "input", required: true, autocomplete: "name" %>
<%= label_tag :password, t(".password"), class: "label" %><%= password_field_tag :password, nil, class: "input", required: true, autocomplete: "new-password", minlength: User::PASSWORD_MIN, maxlength: 72 %>

<%= t(".password_hint", min: User::PASSWORD_MIN) %>

<%= label_tag :password_confirmation, t(".confirm_password"), class: "label" %><%= password_field_tag :password_confirmation, nil, class: "input", required: true, autocomplete: "new-password" %>
<%= submit_tag t(".create_account"), class: "btn-secondary", data: { turbo_submits_with: t(".creating") } %> <% end %> <% end %>