diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-12-11 18:10:12 +0100 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-12-11 18:10:12 +0100 |
commit | 3784181e4fad3c947dfa95081d8a0b34f5be12d4 (patch) | |
tree | 48263aa693149f997cdd7ac0c51bf0f994743748 /templates/base.qtpl.go | |
parent | 57efc8d2173fdff1ef99157a2633d3f1d366a290 (diff) | |
download | cerrado-3784181e4fad3c947dfa95081d8a0b34f5be12d4.tar.gz cerrado-3784181e4fad3c947dfa95081d8a0b34f5be12d4.tar.bz2 cerrado-3784181e4fad3c947dfa95081d8a0b34f5be12d4.zip |
feat: Disable auth if passphrase is empty
Disable all auth mechanism when passphrase is empty. That will allow for
a simpler setup.
Diffstat (limited to 'templates/base.qtpl.go')
-rw-r--r-- | templates/base.qtpl.go | 58 |
1 files changed, 32 insertions, 26 deletions
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(` <!DOCTYPE html> <html lang="en"> @@ -97,64 +103,64 @@ func StreamPageTemplate(qw422016 *qt422016.Writer, p Page, ctx context.Context) <meta charset="utf-8"> <link rel="icon" href="data:,"> <title>`) -//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(`</title> <link rel="stylesheet" href="/static/main`) -//line templates/base.qtpl:55 +//line templates/base.qtpl:62 qw422016.E().S(Slug) -//line templates/base.qtpl:55 +//line templates/base.qtpl:62 qw422016.N().S(`.css"> <meta content="text/html;charset=utf-8" http-equiv="Content-Type"> <meta name="viewport" content="width=device-width, initial-scale=1" /> </head> <body> `) -//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(` <div class="container"> `) -//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(` </div> </body> `) -//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(` </html> `) -//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 } |