From 3784181e4fad3c947dfa95081d8a0b34f5be12d4 Mon Sep 17 00:00:00 2001 From: "Gabriel A. Giovanini" Date: Wed, 11 Dec 2024 18:10:12 +0100 Subject: feat: Disable auth if passphrase is empty Disable all auth mechanism when passphrase is empty. That will allow for a simpler setup. --- templates/base.qtpl.go | 58 ++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 26 deletions(-) (limited to 'templates/base.qtpl.go') diff --git a/templates/base.qtpl.go b/templates/base.qtpl.go index 5bb4532..796538e 100644 --- a/templates/base.qtpl.go +++ b/templates/base.qtpl.go @@ -79,7 +79,13 @@ func Ignore[T any](v T, _ error) T { return v } -//line templates/base.qtpl:41 +//line templates/base.qtpl:42 +func IsAuthenticationDisabled(ctx context.Context) bool { + t, ok := ctx.Value("disableAuthentication").(bool) + return ok && t +} + +//line templates/base.qtpl:48 func IsLoggedIn(ctx context.Context) bool { t, ok := ctx.Value("logged").(bool) return ok && t @@ -87,9 +93,9 @@ func IsLoggedIn(ctx context.Context) bool { // Page prints a page implementing Page interface. -//line templates/base.qtpl:48 +//line templates/base.qtpl:55 func StreamPageTemplate(qw422016 *qt422016.Writer, p Page, ctx context.Context) { -//line templates/base.qtpl:48 +//line templates/base.qtpl:55 qw422016.N().S(` @@ -97,64 +103,64 @@ func StreamPageTemplate(qw422016 *qt422016.Writer, p Page, ctx context.Context) `) -//line templates/base.qtpl:54 +//line templates/base.qtpl:61 p.StreamTitle(qw422016, ctx) -//line templates/base.qtpl:54 +//line templates/base.qtpl:61 qw422016.N().S(` `) -//line templates/base.qtpl:60 +//line templates/base.qtpl:67 p.StreamNavbar(qw422016, ctx) -//line templates/base.qtpl:60 +//line templates/base.qtpl:67 qw422016.N().S(`
`) -//line templates/base.qtpl:62 +//line templates/base.qtpl:69 p.StreamContent(qw422016, ctx) -//line templates/base.qtpl:62 +//line templates/base.qtpl:69 qw422016.N().S(`
`) -//line templates/base.qtpl:65 +//line templates/base.qtpl:72 p.StreamScript(qw422016, ctx) -//line templates/base.qtpl:65 +//line templates/base.qtpl:72 qw422016.N().S(` `) -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 } -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 func WritePageTemplate(qq422016 qtio422016.Writer, p Page, ctx context.Context) { -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 StreamPageTemplate(qw422016, p, ctx) -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 qt422016.ReleaseWriter(qw422016) -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 } -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 func PageTemplate(p Page, ctx context.Context) string { -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 qb422016 := qt422016.AcquireByteBuffer() -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 WritePageTemplate(qb422016, p, ctx) -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 qs422016 := string(qb422016.B) -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 qt422016.ReleaseByteBuffer(qb422016) -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 return qs422016 -//line templates/base.qtpl:67 +//line templates/base.qtpl:74 } -- cgit v1.2.3