mirror of
https://github.com/boringproxy/boringproxy.git
synced 2025-02-25 18:55:29 -06:00
Include styles on login page
This commit is contained in:
parent
e4c3379ed2
commit
d04804e8ac
@ -11,12 +11,6 @@
|
||||
<style>
|
||||
{{.Styles}}
|
||||
|
||||
.dialog {
|
||||
margin: 20px;
|
||||
padding: 20px;
|
||||
font-size: 18px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
@ -8,13 +8,21 @@
|
||||
|
||||
<link rel="icon" href="data:image/gif;base64,R0lGODlhEAAQAAAAACwAAAAAAQABAAACASgAOw==">
|
||||
|
||||
<style>
|
||||
{{.Styles}}
|
||||
|
||||
button {
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form action="/login" method="post">
|
||||
<form class='dialog' action="/login" method="post">
|
||||
<label for="mail">E-mail:</label>
|
||||
<input type="email" id="mail" name="email">
|
||||
<button type="submit">Login</button>
|
||||
<button class='button green-button' type="submit">Login</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -79,6 +79,13 @@ main {
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.dialog {
|
||||
margin: 20px;
|
||||
padding: 20px;
|
||||
font-size: 18px;
|
||||
border: 1px solid black;
|
||||
}
|
||||
|
||||
.tunnel-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
@ -29,6 +29,10 @@ type ConfirmData struct {
|
||||
CancelUrl string
|
||||
}
|
||||
|
||||
type LoginData struct {
|
||||
Styles template.CSS
|
||||
}
|
||||
|
||||
func NewWebUiHandler(config *BoringProxyConfig, db *Database, auth *Auth, tunMan *TunnelManager) *WebUiHandler {
|
||||
return &WebUiHandler{
|
||||
config,
|
||||
@ -62,7 +66,7 @@ func (h *WebUiHandler) handleWebUiRequest(w http.ResponseWriter, r *http.Request
|
||||
token, err := extractToken("access_token", r)
|
||||
if err != nil {
|
||||
|
||||
loginTemplate, err := box.String("login.tmpl")
|
||||
loginTemplateStr, err := box.String("login.tmpl")
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
w.WriteHeader(500)
|
||||
@ -70,8 +74,21 @@ func (h *WebUiHandler) handleWebUiRequest(w http.ResponseWriter, r *http.Request
|
||||
return
|
||||
}
|
||||
|
||||
loginTemplate, err := template.New("test").Parse(loginTemplateStr)
|
||||
if err != nil {
|
||||
w.WriteHeader(500)
|
||||
log.Println(err)
|
||||
io.WriteString(w, "Error compiling login.tmpl")
|
||||
return
|
||||
}
|
||||
|
||||
loginData := LoginData{
|
||||
Styles: template.CSS(stylesText),
|
||||
}
|
||||
|
||||
|
||||
w.WriteHeader(401)
|
||||
io.WriteString(w, loginTemplate)
|
||||
loginTemplate.Execute(w, loginData)
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user