CSS for server
parent
4708b68742
commit
e29dc1b5d8
|
|
@ -1,6 +1,7 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"local/oauth2/oauth2server/config"
|
||||
"local/router"
|
||||
"local/storage"
|
||||
|
|
@ -46,3 +47,33 @@ func purgeIssuedCredentials(store storage.DB) {
|
|||
store.Set(token, nil, TOKEN)
|
||||
}
|
||||
}
|
||||
|
||||
func wrapBody(title, body string) string {
|
||||
return fmt.Sprintf(`
|
||||
<html>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no">
|
||||
<title>%s</title>
|
||||
<style>body{
|
||||
max-width: 960px;
|
||||
overflow: hidden;
|
||||
filter:invert(80%%);
|
||||
background-color: #222;
|
||||
font-size: 5em;
|
||||
zoom: 1.5;
|
||||
-moz-transform: scale(1.5);
|
||||
-moz-transform-origin: 0 0;
|
||||
-o-transform: scale(1.5);
|
||||
-o-transform-origin: 0 0;
|
||||
-webkit-transform: scale(1.5);
|
||||
-webkit-transform-origin: 0 0;
|
||||
transform: scale(1.5);
|
||||
transform-origin: 0 0;
|
||||
}</style>
|
||||
</head>
|
||||
<body>
|
||||
%s
|
||||
</body>
|
||||
</html>
|
||||
`, title, body)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,62 +18,26 @@ func (s *Server) usersLog(w http.ResponseWriter, r *http.Request) {
|
|||
router.Params(r, &scope)
|
||||
s.limiter.Wait(r.Context())
|
||||
q := r.URL.Query()
|
||||
fmt.Fprintln(w, `
|
||||
<html>
|
||||
<head><title>BOA Log In `+scope+`</title><style>body{
|
||||
filter:invert(80%);
|
||||
background-color: #222;
|
||||
font-size: 5em;
|
||||
zoom: 1.5;
|
||||
-moz-transform: scale(1.5);
|
||||
-moz-transform-origin: 0 0;
|
||||
-o-transform: scale(1.5);
|
||||
-o-transform-origin: 0 0;
|
||||
-webkit-transform: scale(1.5);
|
||||
-webkit-transform-origin: 0 0;
|
||||
transform: scale(1.5);
|
||||
transform-origin: 0 0;
|
||||
}</style></head>
|
||||
<body>
|
||||
fmt.Fprintln(w, wrapBody("BOA Log In "+scope, `
|
||||
<h6 style="margin: 0;">`+scope+`</h6>
|
||||
<form method="post" action="/authorize/`+scope+`?`+q.Encode()+`">
|
||||
<input type="password" name="username" autofocus></input>
|
||||
<input type="submit"></input>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
`)
|
||||
`))
|
||||
}
|
||||
|
||||
func (s *Server) usersRegister(w http.ResponseWriter, r *http.Request) {
|
||||
scope := ""
|
||||
router.Params(r, &scope)
|
||||
s.limiter.Wait(r.Context())
|
||||
fmt.Fprintln(w, `
|
||||
<html>
|
||||
<head><title>BOA Register `+scope+`</title><style>body{
|
||||
filter:invert(80%);
|
||||
background-color: #222;
|
||||
font-size: 5em;
|
||||
zoom: 1.5;
|
||||
-moz-transform: scale(1.5);
|
||||
-moz-transform-origin: 0 0;
|
||||
-o-transform: scale(1.5);
|
||||
-o-transform-origin: 0 0;
|
||||
-webkit-transform: scale(1.5);
|
||||
-webkit-transform-origin: 0 0;
|
||||
transform: scale(1.5);
|
||||
transform-origin: 0 0;
|
||||
}</style></head>
|
||||
<body>
|
||||
fmt.Fprintln(w, wrapBody("BOA Register "+scope, `
|
||||
<h6 style="margin: 0;">`+scope+`</h6>
|
||||
<form method="post" action="/users/submit/`+scope+`">
|
||||
<input type="text" name="username" autofocus></input>
|
||||
<input type="submit"></input>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
`)
|
||||
`))
|
||||
}
|
||||
|
||||
func (s *Server) usersSubmit(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue