aboutsummaryrefslogtreecommitdiffstats
path: root/web/command/html/password.go
diff options
context:
space:
mode:
Diffstat (limited to 'web/command/html/password.go')
-rw-r--r--web/command/html/password.go53
1 files changed, 53 insertions, 0 deletions
diff --git a/web/command/html/password.go b/web/command/html/password.go
new file mode 100644
index 0000000..3c53048
--- /dev/null
+++ b/web/command/html/password.go
@@ -0,0 +1,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"),
+ ),
+ ),
+ ),
+ }),
+ )
+}