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 | |
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')
-rw-r--r-- | templates/login.qtpl | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/templates/login.qtpl b/templates/login.qtpl index eee5711..7815bd7 100644 --- a/templates/login.qtpl +++ b/templates/login.qtpl @@ -1,31 +1,41 @@ +{% import "context" %} + {% code type LoginPage struct { + ErrorMessage string } %} -{% func (p *LoginPage) Title() %}Hello{% endfunc %} +{% func (p *LoginPage) Title(ctx context.Context) %}Hello{% endfunc %} -{% func (p *LoginPage) Navbar() %}{%= Navbar(Login) %}{% endfunc %} +{% func (p *LoginPage) Navbar(ctx context.Context) %}{%= Navbar(ctx, Login) %}{% endfunc %} -{% func (p *LoginPage) Content() %} +{% func (p *LoginPage) Content(ctx context.Context) %} <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> + {% if p.ErrorMessage != "" %} + <div class="col-md-6 offset-md-3"> + <div class="alert alert-warning text-center" > + {%s p.ErrorMessage %} + </div> + </div> + {% endif %} </div> {% endfunc %} -{% func (p *LoginPage) Script() %} +{% func (p *LoginPage) Script(ctx context.Context) %} {% endfunc %} |