The terminal states (expired / already-used / not-found) were duplicated as markup in show and result, and #verify re-implemented the nil→expired→!pending cascade that #show already had — a copy edit meant four touch points. - device_code_state(dc) resolves a code to :not_found / :expired / :already_handled / :ok. Both #show and #verify branch on it, so the cascade lives in one place. - _terminal_state partial renders the terminal heading/message/link once; result.html.erb now renders it instead of inlining the markup. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01F7cwhwDJp3MJJDoNPVE6zq
38 lines
1.9 KiB
ERB
38 lines
1.9 KiB
ERB
<div class="mx-auto max-w-md">
|
|
<div class="bg-white dark:bg-gray-800 py-8 px-6 shadow rounded-lg sm:px-10 text-center">
|
|
<% case @state %>
|
|
<% when :approved %>
|
|
<svg class="mx-auto h-14 w-14 text-green-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7"/>
|
|
</svg>
|
|
<h2 class="mt-4 text-2xl font-bold text-gray-900 dark:text-gray-100">Device approved</h2>
|
|
<p class="mt-3 text-sm text-gray-600 dark:text-gray-400">
|
|
<strong><%= @application.name %></strong> now has access to your account. You can return to your
|
|
terminal — it will continue automatically. You may close this tab.
|
|
</p>
|
|
|
|
<% when :denied %>
|
|
<svg class="mx-auto h-14 w-14 text-gray-400" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12"/>
|
|
</svg>
|
|
<h2 class="mt-4 text-2xl font-bold text-gray-900 dark:text-gray-100">Request denied</h2>
|
|
<p class="mt-3 text-sm text-gray-600 dark:text-gray-400">
|
|
No access was granted. You can close this tab.
|
|
</p>
|
|
|
|
<% when :not_allowed %>
|
|
<svg class="mx-auto h-14 w-14 text-red-500" fill="none" viewBox="0 0 24 24" stroke="currentColor" stroke-width="2">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"/>
|
|
</svg>
|
|
<h2 class="mt-4 text-2xl font-bold text-gray-900 dark:text-gray-100">Access not allowed</h2>
|
|
<p class="mt-3 text-sm text-gray-600 dark:text-gray-400">
|
|
Your account isn't a member of a group permitted to use <strong><%= @application.name %></strong>.
|
|
Contact an administrator if you think this is a mistake.
|
|
</p>
|
|
|
|
<% else %>
|
|
<%= render "terminal_state", state: @state %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|