all repos — flounder @ 5b4a8b771c8c011af9c4f60ce0725225545b325d

A small site builder for the Gemini protocol

Add created time for users to admin page
alex wennerberg alex@alexwennerberg.com
Mon, 01 Feb 2021 21:58:41 -0800
commit

5b4a8b771c8c011af9c4f60ce0725225545b325d

parent

758676c26d0a87c9354a795aed370bc06b91be6b

3 files changed, 5 insertions(+), 2 deletions(-)

jump to
M db.godb.go

@@ -73,7 +73,7 @@ Username string

Email string Active bool Admin bool - CreatedAt int // timestamp + CreatedAt int64 // timestamp Reference string Domain string DomainEnabled bool
M http.gohttp.go

@@ -726,7 +726,9 @@

func runHTTPServer() { log.Printf("Running http server with hostname %s on port %d.", c.Host, c.HttpPort) var err error - t = template.New("main").Funcs(template.FuncMap{"parent": path.Dir, "hasSuffix": strings.HasSuffix, + t = template.New("main").Funcs(template.FuncMap{ + "unixTime": time.Unix, + "parent": path.Dir, "hasSuffix": strings.HasSuffix, "safeGeminiURL": func(u string) template.URL { if strings.HasPrefix(u, "gemini://") { return template.URL(u)
M templates/admin.htmltemplates/admin.html

@@ -10,6 +10,7 @@ <p>Home: <a href="//{{.Username}}.{{$.Config.Host}}">{{.Username}}</a> </p>

<p>Email: <a href=mailto:{{.Email}}>{{.Email}}</a></p> <p>Reference: {{.Reference}}</p> <p>Domain: {{.Domain}}</p> + <p>Created: {{unixTime .CreatedAt 0}}</p> {{ if not .Active }} <p> <form action="/admin/user/{{.Username}}/activate" method="POST" class="inline">