A vibe coded tangled fork which supports pijul.
at 7a9bd70992a22c366ce21db1bfa023727a96ec95 114 lines 4.5 kB view raw
1{{ define "title" }} login {{ end }} 2 3{{ define "content" }} 4 {{ if .AddAccount }} 5 <div class="flex gap-2 my-4 bg-blue-50 dark:bg-blue-900/30 border border-blue-300 dark:border-sky-800 rounded px-3 py-2 text-blue-600 dark:text-blue-300"> 6 <span class="py-1">{{ i "user-plus" "w-4 h-4" }}</span> 7 <div> 8 <h5 class="font-medium">Add another account</h5> 9 <p class="text-sm">Sign in with a different account to add it to your account list.</p> 10 </div> 11 </div> 12 {{ end }} 13 14 {{ if .Accounts }} 15 <div class="my-4 border border-gray-200 dark:border-gray-700 rounded overflow-hidden"> 16 <div class="px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"> 17 <span class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium">Saved accounts</span> 18 </div> 19 <div class="divide-y divide-gray-200 dark:divide-gray-700"> 20 {{ range .Accounts }} 21 <div class="flex items-center justify-between px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700"> 22 <button 23 type="button" 24 hx-post="/account/switch" 25 hx-vals='{"did": "{{ .Did }}"}' 26 hx-swap="none" 27 class="flex items-center gap-2 flex-1 text-left min-w-0" 28 > 29 {{ template "user/fragments/pic" (list .Did "size-8") }} 30 <div class="flex flex-col min-w-0"> 31 <span class="text-sm font-medium dark:text-white truncate">{{ .Did | resolve | truncateAt30 }}</span> 32 <span class="text-xs text-gray-500 dark:text-gray-400">Click to switch</span> 33 </div> 34 </button> 35 <button 36 type="button" 37 hx-delete="/account/{{ .Did }}" 38 hx-swap="none" 39 class="p-1 text-gray-400 hover:text-red-500 dark:hover:text-red-400 flex-shrink-0" 40 title="Remove account" 41 > 42 {{ i "x" "w-4 h-4" }} 43 </button> 44 </div> 45 {{ end }} 46 </div> 47 </div> 48 {{ end }} 49 50 <form 51 class="mt-4 group" 52 hx-post="/login" 53 hx-swap="none" 54 hx-disabled-elt="#login-button" 55 > 56 <div class="flex flex-col"> 57 <label for="handle">handle</label> 58 <input 59 autocapitalize="none" 60 autocorrect="off" 61 autocomplete="username" 62 type="text" 63 id="handle" 64 name="handle" 65 tabindex="1" 66 required 67 placeholder="akshay.tngl.sh" 68 /> 69 <span class="text-sm text-gray-500 mt-1"> 70 Use your <a href="https://atproto.com">AT Protocol</a> 71 handle to log in. If you're unsure, this is likely 72 your Tangled (<code>.tngl.sh</code>) or <a href="https://bsky.app">Bluesky</a> (<code>.bsky.social</code>) account. 73 </span> 74 </div> 75 <input type="hidden" name="return_url" value="{{ .ReturnUrl }}"> 76 <input type="hidden" name="add_account" value="{{ if .AddAccount }}true{{ end }}"> 77 78 <button 79 class="btn w-full my-2 mt-6 text-base" 80 type="submit" 81 id="login-button" 82 tabindex="3" 83 > 84 {{ i "loader-circle" "size-4 animate-spin hidden group-[.htmx-request]:inline" }} 85 <span class="inline group-[.htmx-request]:hidden">login</span> 86 </button> 87 </form> 88 {{ if .ErrorCode }} 89 <div class="flex gap-2 my-2 bg-red-50 dark:bg-red-900 border border-red-500 rounded drop-shadow-sm px-3 py-2 text-red-500 dark:text-red-300"> 90 <span class="py-1">{{ i "circle-alert" "w-4 h-4" }}</span> 91 <div> 92 <h5 class="font-medium">Login error</h5> 93 <p class="text-sm"> 94 {{ if eq .ErrorCode "access_denied" }} 95 You have not authorized the app. 96 {{ else if eq .ErrorCode "session" }} 97 Server failed to create user session. 98 {{ else if eq .ErrorCode "max_accounts" }} 99 You have reached the maximum of 20 linked accounts. Please remove an account before adding a new one. 100 {{ else }} 101 Internal Server error. 102 {{ end }} 103 Please try again. 104 </p> 105 </div> 106 </div> 107 {{ end }} 108 <p class="text-sm text-gray-500"> 109 Don't have an account? <a href="/signup" class="underline">Create an account</a> on Tangled now! 110 </p> 111 112 <p id="login-msg" class="error w-full"></p> 113{{ end }} 114