-
Notifications
You must be signed in to change notification settings - Fork 0
/
login_form.go
54 lines (51 loc) · 1.54 KB
/
login_form.go
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
47
48
49
50
51
52
53
54
package login
import (
"html/template"
"io"
)
const loginForm = `<!DOCTYPE html>
<html>
<head>
<link uic-remove rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<style>
.vertical-offset-100{
padding-top:100px;
}
</style>
</head>
<body>
<uic-fragment name="content">
<div class="container">
<div class="row vertical-offset-100">
<div class="col-md-4 col-md-offset-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Please sign in</h3>
{{ if .error}}Internal Error. Please try again later{{end}}
{{ if .failure}}Wrong credentials{{end}}
</div>
<div class="panel-body">
<form accept-charset="UTF-8" role="form" method="POST" action="{{.path}}">
<fieldset>
<div class="form-group">
<input class="form-control" placeholder="Username" name="username" value="{{.username}}" type="text">
</div>
<div class="form-group">
<input class="form-control" placeholder="Password" name="password" type="password" value="">
</div>
<input class="btn btn-lg btn-success btn-block" type="submit" value="Login">
</fieldset>
</form>
</div>
</div>
</div>
</div>
</div>
</uic-fragment>
</body>
</html>
`
func writeLoginForm(w io.Writer, params map[string]interface{}) {
t := template.Must(template.New("loginForm").Parse(loginForm))
t.Execute(w, params)
}