From 66bd5d2f7fd84eec39d69f4a8f5c435fc978804f Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Thu, 19 Mar 2026 17:14:20 +0000 Subject: Add site passwords --- pkg/html/password.go | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 pkg/html/password.go (limited to 'pkg/html') diff --git a/pkg/html/password.go b/pkg/html/password.go new file mode 100644 index 0000000..ba23a06 --- /dev/null +++ b/pkg/html/password.go @@ -0,0 +1,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"), + ), + ), + ), + ) +} -- cgit v1.2.3-70-g09d2