diff options
author | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-12-11 17:05:12 +0100 |
---|---|---|
committer | Gabriel A. Giovanini <mail@gabrielgio.me> | 2024-12-11 17:05:12 +0100 |
commit | 1e45ae2ea3497958b2ea6a20137955cfc3bbc964 (patch) | |
tree | 00af0e28864d79d7a9cbb8b693aff1b397b1a949 /templates/login.qtpl.go | |
parent | e6ded0d01117c592ec124f3e02d6c89eeafec382 (diff) | |
download | cerrado-1e45ae2ea3497958b2ea6a20137955cfc3bbc964.tar.gz cerrado-1e45ae2ea3497958b2ea6a20137955cfc3bbc964.tar.bz2 cerrado-1e45ae2ea3497958b2ea6a20137955cfc3bbc964.zip |
feat: Add UI/Handler login process
It adds the whole workflow to store and handle login on both UI and
handler level. With that the login information should be available at
any point given the context.
Diffstat (limited to 'templates/login.qtpl.go')
-rw-r--r-- | templates/login.qtpl.go | 195 |
1 files changed, 109 insertions, 86 deletions
diff --git a/templates/login.qtpl.go b/templates/login.qtpl.go index 0d3d2b0..5c07a44 100644 --- a/templates/login.qtpl.go +++ b/templates/login.qtpl.go @@ -5,169 +5,192 @@ package templates //line templates/login.qtpl:1 +import "context" + +//line templates/login.qtpl:3 import ( qtio422016 "io" qt422016 "github.com/valyala/quicktemplate" ) -//line templates/login.qtpl:1 +//line templates/login.qtpl:3 var ( _ = qtio422016.Copy _ = qt422016.AcquireByteBuffer ) -//line templates/login.qtpl:2 +//line templates/login.qtpl:4 type LoginPage struct { + ErrorMessage string } -//line templates/login.qtpl:6 -func (p *LoginPage) StreamTitle(qw422016 *qt422016.Writer) { -//line templates/login.qtpl:6 +//line templates/login.qtpl:9 +func (p *LoginPage) StreamTitle(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/login.qtpl:9 qw422016.N().S(`Hello`) -//line templates/login.qtpl:6 +//line templates/login.qtpl:9 } -//line templates/login.qtpl:6 -func (p *LoginPage) WriteTitle(qq422016 qtio422016.Writer) { -//line templates/login.qtpl:6 +//line templates/login.qtpl:9 +func (p *LoginPage) WriteTitle(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/login.qtpl:9 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/login.qtpl:6 - p.StreamTitle(qw422016) -//line templates/login.qtpl:6 +//line templates/login.qtpl:9 + p.StreamTitle(qw422016, ctx) +//line templates/login.qtpl:9 qt422016.ReleaseWriter(qw422016) -//line templates/login.qtpl:6 +//line templates/login.qtpl:9 } -//line templates/login.qtpl:6 -func (p *LoginPage) Title() string { -//line templates/login.qtpl:6 +//line templates/login.qtpl:9 +func (p *LoginPage) Title(ctx context.Context) string { +//line templates/login.qtpl:9 qb422016 := qt422016.AcquireByteBuffer() -//line templates/login.qtpl:6 - p.WriteTitle(qb422016) -//line templates/login.qtpl:6 +//line templates/login.qtpl:9 + p.WriteTitle(qb422016, ctx) +//line templates/login.qtpl:9 qs422016 := string(qb422016.B) -//line templates/login.qtpl:6 +//line templates/login.qtpl:9 qt422016.ReleaseByteBuffer(qb422016) -//line templates/login.qtpl:6 +//line templates/login.qtpl:9 return qs422016 -//line templates/login.qtpl:6 +//line templates/login.qtpl:9 } -//line templates/login.qtpl:8 -func (p *LoginPage) StreamNavbar(qw422016 *qt422016.Writer) { -//line templates/login.qtpl:8 - StreamNavbar(qw422016, Login) -//line templates/login.qtpl:8 +//line templates/login.qtpl:11 +func (p *LoginPage) StreamNavbar(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/login.qtpl:11 + StreamNavbar(qw422016, ctx, Login) +//line templates/login.qtpl:11 } -//line templates/login.qtpl:8 -func (p *LoginPage) WriteNavbar(qq422016 qtio422016.Writer) { -//line templates/login.qtpl:8 +//line templates/login.qtpl:11 +func (p *LoginPage) WriteNavbar(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/login.qtpl:11 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/login.qtpl:8 - p.StreamNavbar(qw422016) -//line templates/login.qtpl:8 +//line templates/login.qtpl:11 + p.StreamNavbar(qw422016, ctx) +//line templates/login.qtpl:11 qt422016.ReleaseWriter(qw422016) -//line templates/login.qtpl:8 +//line templates/login.qtpl:11 } -//line templates/login.qtpl:8 -func (p *LoginPage) Navbar() string { -//line templates/login.qtpl:8 +//line templates/login.qtpl:11 +func (p *LoginPage) Navbar(ctx context.Context) string { +//line templates/login.qtpl:11 qb422016 := qt422016.AcquireByteBuffer() -//line templates/login.qtpl:8 - p.WriteNavbar(qb422016) -//line templates/login.qtpl:8 +//line templates/login.qtpl:11 + p.WriteNavbar(qb422016, ctx) +//line templates/login.qtpl:11 qs422016 := string(qb422016.B) -//line templates/login.qtpl:8 +//line templates/login.qtpl:11 qt422016.ReleaseByteBuffer(qb422016) -//line templates/login.qtpl:8 +//line templates/login.qtpl:11 return qs422016 -//line templates/login.qtpl:8 +//line templates/login.qtpl:11 } -//line templates/login.qtpl:10 -func (p *LoginPage) StreamContent(qw422016 *qt422016.Writer) { -//line templates/login.qtpl:10 +//line templates/login.qtpl:13 +func (p *LoginPage) StreamContent(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/login.qtpl:13 qw422016.N().S(` <div class="row"> <div class="col-md-6 offset-md-3"> - <form> + <form action="/login/" method="POST"> <div class="form-group m-3"> <label for="username" class="form-label">Username</label> - <input type="text" class="form-control" id="username" aria-describedby="emailHelp"> + <input type="text" class="form-control" name="username" id="username"> </div> <div class="form-group m-3"> <label for="password" class="form-label">Password</label> - <input type="password" class="form-control" id="password"> + <input type="password" class="form-control" name="password" id="password"> </div> <div class="form-group m-3"> <button type="submit" class="btn btn-primary">Login</button> </div> </form> </div> + `) +//line templates/login.qtpl:30 + if p.ErrorMessage != "" { +//line templates/login.qtpl:30 + qw422016.N().S(` + <div class="col-md-6 offset-md-3"> + <div class="alert alert-warning text-center" > + `) +//line templates/login.qtpl:33 + qw422016.E().S(p.ErrorMessage) +//line templates/login.qtpl:33 + qw422016.N().S(` + </div> + </div> + `) +//line templates/login.qtpl:36 + } +//line templates/login.qtpl:36 + qw422016.N().S(` </div> `) -//line templates/login.qtpl:28 +//line templates/login.qtpl:38 } -//line templates/login.qtpl:28 -func (p *LoginPage) WriteContent(qq422016 qtio422016.Writer) { -//line templates/login.qtpl:28 +//line templates/login.qtpl:38 +func (p *LoginPage) WriteContent(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/login.qtpl:38 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/login.qtpl:28 - p.StreamContent(qw422016) -//line templates/login.qtpl:28 +//line templates/login.qtpl:38 + p.StreamContent(qw422016, ctx) +//line templates/login.qtpl:38 qt422016.ReleaseWriter(qw422016) -//line templates/login.qtpl:28 +//line templates/login.qtpl:38 } -//line templates/login.qtpl:28 -func (p *LoginPage) Content() string { -//line templates/login.qtpl:28 +//line templates/login.qtpl:38 +func (p *LoginPage) Content(ctx context.Context) string { +//line templates/login.qtpl:38 qb422016 := qt422016.AcquireByteBuffer() -//line templates/login.qtpl:28 - p.WriteContent(qb422016) -//line templates/login.qtpl:28 +//line templates/login.qtpl:38 + p.WriteContent(qb422016, ctx) +//line templates/login.qtpl:38 qs422016 := string(qb422016.B) -//line templates/login.qtpl:28 +//line templates/login.qtpl:38 qt422016.ReleaseByteBuffer(qb422016) -//line templates/login.qtpl:28 +//line templates/login.qtpl:38 return qs422016 -//line templates/login.qtpl:28 +//line templates/login.qtpl:38 } -//line templates/login.qtpl:30 -func (p *LoginPage) StreamScript(qw422016 *qt422016.Writer) { -//line templates/login.qtpl:30 +//line templates/login.qtpl:40 +func (p *LoginPage) StreamScript(qw422016 *qt422016.Writer, ctx context.Context) { +//line templates/login.qtpl:40 qw422016.N().S(` `) -//line templates/login.qtpl:31 +//line templates/login.qtpl:41 } -//line templates/login.qtpl:31 -func (p *LoginPage) WriteScript(qq422016 qtio422016.Writer) { -//line templates/login.qtpl:31 +//line templates/login.qtpl:41 +func (p *LoginPage) WriteScript(qq422016 qtio422016.Writer, ctx context.Context) { +//line templates/login.qtpl:41 qw422016 := qt422016.AcquireWriter(qq422016) -//line templates/login.qtpl:31 - p.StreamScript(qw422016) -//line templates/login.qtpl:31 +//line templates/login.qtpl:41 + p.StreamScript(qw422016, ctx) +//line templates/login.qtpl:41 qt422016.ReleaseWriter(qw422016) -//line templates/login.qtpl:31 +//line templates/login.qtpl:41 } -//line templates/login.qtpl:31 -func (p *LoginPage) Script() string { -//line templates/login.qtpl:31 +//line templates/login.qtpl:41 +func (p *LoginPage) Script(ctx context.Context) string { +//line templates/login.qtpl:41 qb422016 := qt422016.AcquireByteBuffer() -//line templates/login.qtpl:31 - p.WriteScript(qb422016) -//line templates/login.qtpl:31 +//line templates/login.qtpl:41 + p.WriteScript(qb422016, ctx) +//line templates/login.qtpl:41 qs422016 := string(qb422016.B) -//line templates/login.qtpl:31 +//line templates/login.qtpl:41 qt422016.ReleaseByteBuffer(qb422016) -//line templates/login.qtpl:31 +//line templates/login.qtpl:41 return qs422016 -//line templates/login.qtpl:31 +//line templates/login.qtpl:41 } |