aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/html/password.go
blob: ba23a067065f87fd23909717a82ecccda876ddb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package html

import (
	"net/url"

	. "github.com/LMBishop/scrapbook/web/skeleton"
	. "maragu.dev/gomponents"
	. "maragu.dev/gomponents/html"
)

func AuthenticateSitePage(err, redirect, siteName string) Node {
	return Page("Authenticate",
		H1(Text("A password is required to visit this site")),

		If(err != "", AlertError(err)),

		Form(
			Action("/authenticate?redirect="+url.QueryEscape(redirect)),
			Method("post"),

			FieldSet(
				Legend(Text("Authentication")),
				Label(
					For("password"),
					Text("Password"),
				),
				Input(
					ID("password"),
					Name("password"),
					Type("password"),
				),
				Span(
					Class("form-help"),
					Text("Enter the password to continue."),
				),
			),

			Div(
				Class("control-group group-right"),
				Input(
					Type("submit"),
					Value("Submit"),
				),
			),
		),
	)
}