Files
comfychan/web/views/admin/login.templ
T
2025-04-23 15:12:46 -04:00

45 lines
1023 B
Templ

package admin
import "github.com/dominicf2001/comfychan/web/views/shared"
templ AdminLogin() {
@shared.Layout() {
<div class="admin-login-container">
<div style="display: none" id="adminLoginWarning" class="warning"></div>
<form
hx-post="/authorize"
hx-swap="none"
id="adminLoginForm"
_="
on htmx:beforeRequest toggle @disabled on <button/> until htmx:afterRequest
on htmx:afterRequest
if event.detail.xhr.status is 401
show #adminLoginWarning
put event.detail.xhr.responseText into #adminLoginWarning
else
go to url /
end
"
>
<table>
<tbody>
<tr
class="new-post-form-field"
>
<th>Username</th>
<td><input required name="username"/></td>
</tr>
<tr
class="new-post-form-field"
>
<th>Password</th>
<td><input type="password" required name="password"/></td>
</tr>
</tbody>
</table>
<button type="submit">Submit</button>
</form>
</div>
}
}