A vibe coded tangled fork which supports pijul.
at 48587e5898df17ee6a9a7451fa163b1e40652dd2 134 lines 6.9 kB view raw
1{{ define "user/login" }} 2 <!doctype html> 3 <html lang="en" class="dark:bg-gray-900"> 4 <head> 5 <meta charset="UTF-8" /> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0" /> 7 <meta property="og:title" content="login · tangled" /> 8 <meta property="og:url" content="https://tangled.org/login" /> 9 <meta property="og:description" content="login to for tangled" /> 10 <script src="/static/htmx.min.js"></script> 11 <link rel="manifest" href="/pwa-manifest.json" /> 12 <link rel="stylesheet" href="/static/tw.css?{{ cssContentHash }}" type="text/css" /> 13 <title>login &middot; tangled</title> 14 </head> 15 <body class="flex items-center justify-center min-h-screen"> 16 <main class="max-w-md px-7 mt-4"> 17 <h1 class="flex place-content-center text-3xl font-semibold italic dark:text-white" > 18 {{ template "fragments/logotype" }} 19 </h1> 20 <h2 class="text-center text-xl italic dark:text-white"> 21 tightly-knit social coding. 22 </h2> 23 24 {{ if .AddAccount }} 25 <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"> 26 <span class="py-1">{{ i "user-plus" "w-4 h-4" }}</span> 27 <div> 28 <h5 class="font-medium">Add another account</h5> 29 <p class="text-sm">Sign in with a different account to add it to your account list.</p> 30 </div> 31 </div> 32 {{ end }} 33 34 {{ if .Accounts }} 35 <div class="my-4 border border-gray-200 dark:border-gray-700 rounded overflow-hidden"> 36 <div class="px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"> 37 <span class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium">Saved accounts</span> 38 </div> 39 <div class="divide-y divide-gray-200 dark:divide-gray-700"> 40 {{ range .Accounts }} 41 <div class="flex items-center justify-between px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700"> 42 <button 43 type="button" 44 hx-post="/account/switch" 45 hx-vals='{"did": "{{ .Did }}"}' 46 hx-swap="none" 47 class="flex items-center gap-2 flex-1 text-left min-w-0" 48 > 49 {{ template "user/fragments/pic" (list .Did "size-8") }} 50 <div class="flex flex-col min-w-0"> 51 <span class="text-sm font-medium dark:text-white truncate">{{ .Did | resolve | truncateAt30 }}</span> 52 <span class="text-xs text-gray-500 dark:text-gray-400">Click to switch</span> 53 </div> 54 </button> 55 <button 56 type="button" 57 hx-delete="/account/{{ .Did }}" 58 hx-swap="none" 59 class="p-1 text-gray-400 hover:text-red-500 dark:hover:text-red-400 flex-shrink-0" 60 title="Remove account" 61 > 62 {{ i "x" "w-4 h-4" }} 63 </button> 64 </div> 65 {{ end }} 66 </div> 67 </div> 68 {{ end }} 69 70 <form 71 class="mt-4" 72 hx-post="/login" 73 hx-swap="none" 74 hx-disabled-elt="#login-button" 75 > 76 <div class="flex flex-col"> 77 <label for="handle">handle</label> 78 <input 79 autocapitalize="none" 80 autocorrect="off" 81 autocomplete="username" 82 type="text" 83 id="handle" 84 name="handle" 85 tabindex="1" 86 required 87 placeholder="akshay.tngl.sh" 88 /> 89 <span class="text-sm text-gray-500 mt-1"> 90 Use your <a href="https://atproto.com">AT Protocol</a> 91 handle to log in. If you're unsure, this is likely 92 your Tangled (<code>.tngl.sh</code>) or <a href="https://bsky.app">Bluesky</a> (<code>.bsky.social</code>) account. 93 </span> 94 </div> 95 <input type="hidden" name="return_url" value="{{ .ReturnUrl }}"> 96 97 <button 98 class="btn w-full my-2 mt-6 text-base " 99 type="submit" 100 id="login-button" 101 tabindex="3" 102 > 103 <span>login</span> 104 </button> 105 </form> 106 {{ if .ErrorCode }} 107 <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"> 108 <span class="py-1">{{ i "circle-alert" "w-4 h-4" }}</span> 109 <div> 110 <h5 class="font-medium">Login error</h5> 111 <p class="text-sm"> 112 {{ if eq .ErrorCode "access_denied" }} 113 You have not authorized the app. 114 {{ else if eq .ErrorCode "session" }} 115 Server failed to create user session. 116 {{ else if eq .ErrorCode "max_accounts" }} 117 You have reached the maximum of 20 linked accounts. Please remove an account before adding a new one. 118 {{ else }} 119 Internal Server error. 120 {{ end }} 121 Please try again. 122 </p> 123 </div> 124 </div> 125 {{ end }} 126 <p class="text-sm text-gray-500"> 127 Don't have an account? <a href="/signup" class="underline">Create an account</a> on Tangled now! 128 </p> 129 130 <p id="login-msg" class="error w-full"></p> 131 </main> 132 </body> 133 </html> 134{{ end }}