8 "github.com/oauth2-proxy/oauth2-proxy/pkg/logger"
11func loadTemplates(dir string) *template.Template {
15 logger.Printf("using custom template directory %q", dir)
16 funcMap := template.FuncMap{
17 "ToUpper": strings.ToUpper,
18 "ToLower": strings.ToLower,
20 t, err := template.New("").Funcs(funcMap).ParseFiles(path.Join(dir, "sign_in.html"), path.Join(dir, "error.html"))
22 logger.Fatalf("failed parsing template %s", err)
27func getTemplates() *template.Template {
28 t, err := template.New("foo").Parse(`{{define "sign_in.html"}}
30<html lang="en" charset="utf-8">
32 <title>Sign In</title>
33 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
36 font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
38 line-height: 1.42857143;
47 border:1px solid #ccc;
56 background-color: #428bca;
57 border: 1px solid #357ebd;
58 -webkit-border-radius: 4;
59 -moz-border-radius: 4;
63 text-decoration: none;
68 background-color: #3071a9;
69 border-color: #285e8e;
70 text-decoration: none;
73 display: inline-block;
84 line-height: 1.42857143;
86 background-color: #fff;
87 background-image: none;
88 border: 1px solid #ccc;
90 -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
91 box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
92 -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
93 -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
94 transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
96 box-sizing: border-box;
106 display:inline-block;
110 text-decoration:underline;
118 <div class="signin center">
119 <form method="GET" action="{{.ProxyPrefix}}/start">
120 <input type="hidden" name="rd" value="{{.Redirect}}">
121 {{ if .SignInMessage }}
122 <p>{{.SignInMessage}}</p>
124 <button type="submit" class="btn">Sign in with {{.ProviderName}}</button><br/>
128 {{ if .CustomLogin }}
130 <form method="POST" action="{{.ProxyPrefix}}/sign_in">
131 <input type="hidden" name="rd" value="{{.Redirect}}">
132 <label for="username">Username:</label><input type="text" name="username" id="username" size="10"><br/>
133 <label for="password">Password:</label><input type="password" name="password" id="password" size="10"><br/>
134 <button type="submit" class="btn">Sign In</button>
139 if (window.location.hash) {
141 var inputs = document.getElementsByName('rd');
142 for (var i = 0; i < inputs.length; i++) {
143 // Add hash, but make sure it is only added once
144 var idx = inputs[i].value.indexOf('#');
146 // Remove existing hash from URL
147 inputs[i].value = inputs[i].value.substr(0, idx);
149 inputs[i].value += window.location.hash;
155 {{ if eq .Footer "-" }}
156 {{ else if eq .Footer ""}}
157 Secured with <a href="https://github.com/oauth2-proxy/oauth2-proxy#oauth2_proxy">OAuth2 Proxy</a> version {{.Version}}
166 logger.Fatalf("failed parsing template %s", err)
169 t, err = t.Parse(`{{define "error.html"}}
171<html lang="en" charset="utf-8">
173 <title>{{.Title}}</title>
174 <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
180 <p><a href="{{.ProxyPrefix}}/sign_in">Sign In</a></p>
184 logger.Fatalf("failed parsing template %s", err)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list