+ <%= for {token, index} <- Enum.with_index(@auth_tokens) do %>
+
+
+
<%= token.name %> (<%= if token.expire_at == nil do %>does not expire<% else %>expire on <%= format_datetime(token.expire_at) %><% end %>)
+
<%= token.nb_access %> access since its creation on <%= format_datetime(token.created_at) %><%= if token.last_access != nil do %>, last accessed on <%= format_datetime(token.last_access) %><% end %>.
+
+
+ <%= link(title: "Delete auth token", to: Routes.user_settings_path(@conn, :delete_auth_token, token.id), method: :delete) do %>
+
+ <% end %>
+
+ <% end %>
+ <.form let={f} for={@auth_token_changeset} action={Routes.user_settings_path(@conn, :create_auth_token)}>
+
+
+ <%= label f, :name, "Token name", class: "sr-only" %>
+ <%= text_input f, :name, placeholder: "Token name", required: true, class: "#{if length(@auth_tokens) == 0, do: "rounded-tl-md"} rounded-bl-md relative block w-full border border-gray-300 bg-transparent focus:z-10 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" %>
+ <%= error_tag f, :name %>
+
+
+ <%= label f, :expire_at, "Expiration", class: "sr-only" %>
+ <%= select f, :expire_at, ["does not expire": "none", "expire in 1 hour": "hour", "expire in 1 day": "day", "expire in 1 month": "month"], class: "relative block w-full border border-gray-300 bg-transparent focus:z-10 focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" %>
+ <%= error_tag f, :expire_at %>
+
+ <%= submit "Create token", class: "#{if length(@auth_tokens) == 0, do: "rounded-tr-md"} rounded-br-md relative block border border-gray-300 px-4 py-2 text-sm font-medium bg-gray-50 text-gray-700 hover:bg-gray-100 focus:border-indigo-500 focus:outline-none focus:ring-1 focus:ring-indigo-500 disabled:bg-gray-100 disabled:text-gray-400" %>
+