aboutsummaryrefslogtreecommitdiffstats
path: root/web/command/html/password.go
blob: 3c53048c09940571be178ca2b52a7a0cf0ec1ce2 (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
48
49
50
51
52
53
package html

import (
	"fmt"

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

func PasswordPage(success, err, siteName, passwordValue string) Node {
	return Page("Change password for "+siteName,
		H1(Text("Change password for "+siteName)),

		If(success != "", Group{
			AlertSuccess(success),
			Div(
				Class("control-group group-right"),
				NavButton("OK", fmt.Sprintf("/site/%s/", siteName)),
			),
		}),

		If(success == "", Group{
			If(err != "", AlertError(err)),

			Form(
				Method("post"),

				FieldSet(
					Legend(Text("Password")),
					Input(
						ID("password"),
						Name("password"),
						Value(passwordValue),
					),
					Span(
						Class("form-help"),
						Text("The password visitors must enter to be able to view the site."),
					),
				),

				Div(
					Class("control-group group-right"),
					NavButton("Go back", fmt.Sprintf("/site/%s/", siteName)),
					Input(
						Type("submit"),
						Value("Submit"),
					),
				),
			),
		}),
	)
}