blob: efaf329ded970e0824ee1fc75f52df9be2987e34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
{% import "context" %}
{% code
type LoginPage struct {
Referer string
ErrorMessage string
}
%}
{% func (p *LoginPage) Title(ctx context.Context) %}Hello{% endfunc %}
{% func (p *LoginPage) Navbar(ctx context.Context) %}{%= Navbar(ctx, Login) %}{% endfunc %}
{% func (p *LoginPage) Content(ctx context.Context) %}
<div class="row">
<div class="col-md-6 offset-md-3">
{% if p.Referer == "" %}
<form action="/login/" method="POST">
{% else %}
<form action="/login/?referer={%s p.Referer %}" method="POST">
{% endif %}
<div class="form-group m-3">
<label for="username" class="form-label">Username</label>
<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" 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(ctx context.Context) %}
{% endfunc %}
|