forked from tangled.org/core
Monorepo for Tangled

fix login redirect using hx-redirect

Changed files
+27 -28
appview
pages
templates
user
state
+26 -27
appview/pages/templates/user/login.html
··· 14 14 <body class="flex items-center justify-center min-h-screen"> 15 15 <main class="max-w-64"> 16 16 <h1 class="text-center text-2xl font-semibold">tangled.sh</h1> 17 - <form class="w-full" hx-post="/login" hx-swap="none" hx-disabled-elt="this"> 18 - <div class="flex flex-col"> 19 - <label for="handle">handle</label> 20 - <input 21 - type="text" 22 - id="handle" 23 - name="handle" 24 - required 25 - class="bg-gray-100 rounded p-1" 26 - /> 27 - </div> 17 + <form 18 + class="w-full" 19 + hx-post="/login" 20 + hx-swap="none" 21 + hx-disabled-elt="this" 22 + > 23 + <div class="flex flex-col"> 24 + <label for="handle">handle</label> 25 + <input type="text" id="handle" name="handle" required /> 26 + </div> 28 27 29 - <div class="flex flex-col mt-2"> 30 - <label for="app_password">app password</label> 31 - <input 32 - type="password" 33 - id="app_password" 34 - name="app_password" 35 - required 36 - class="bg-gray-100 rounded p-1" 37 - /> 38 - </div> 28 + <div class="flex flex-col mt-2"> 29 + <label for="app_password">app password</label> 30 + <input 31 + type="password" 32 + id="app_password" 33 + name="app_password" 34 + required 35 + /> 36 + </div> 39 37 40 - <button 41 - class="btn w-full my-2 mt-6" 42 - type="submit" 43 - id="login-button"> 44 - <span>login</span> 45 - </button> 38 + <button 39 + class="btn w-full my-2 mt-6" 40 + type="submit" 41 + id="login-button" 42 + > 43 + <span>login</span> 44 + </button> 46 45 </form> 47 46 <p id="login-msg" class="error w-full"></p> 48 47 </main>
+1 -1
appview/state/state.go
··· 100 100 } 101 101 102 102 log.Printf("successfully saved session for %s (%s)", atSession.Handle, atSession.Did) 103 - http.Redirect(w, r, "/", http.StatusSeeOther) 103 + s.pages.HxRedirect(w, "/") 104 104 return 105 105 } 106 106 }