Implement basic auth
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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="/admin/login"
|
||||
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>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user