Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dex
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hdacloud
dex
Commits
ea52bf26
Commit
ea52bf26
authored
8 years ago
by
Eric Chiang
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #623 from ericchiang/dev-port-oob-template
*: port oob template
parents
86b2d939
7084a801
Branches
Branches containing commit
Tags
v2.0.0-alpha.4
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
server/handlers.go
+1
-2
1 addition, 2 deletions
server/handlers.go
server/templates.go
+12
-0
12 additions, 0 deletions
server/templates.go
server/templates_default.go
+12
-0
12 additions, 0 deletions
server/templates_default.go
web/templates/oob.html
+11
-0
11 additions, 0 deletions
web/templates/oob.html
with
36 additions
and
2 deletions
server/handlers.go
+
1
−
2
View file @
ea52bf26
...
@@ -384,8 +384,7 @@ func (s *Server) sendCodeResponse(w http.ResponseWriter, r *http.Request, authRe
...
@@ -384,8 +384,7 @@ func (s *Server) sendCodeResponse(w http.ResponseWriter, r *http.Request, authRe
}
}
if
authReq
.
RedirectURI
==
redirectURIOOB
{
if
authReq
.
RedirectURI
==
redirectURIOOB
{
// TODO(ericchiang): Add a proper template.
s
.
templates
.
oob
(
w
,
code
.
ID
)
fmt
.
Fprintf
(
w
,
"Code: %s"
,
code
.
ID
)
return
return
}
}
q
.
Set
(
"code"
,
code
.
ID
)
q
.
Set
(
"code"
,
code
.
ID
)
...
...
This diff is collapsed.
Click to expand it.
server/templates.go
+
12
−
0
View file @
ea52bf26
...
@@ -15,6 +15,7 @@ const (
...
@@ -15,6 +15,7 @@ const (
tmplApproval
=
"approval.html"
tmplApproval
=
"approval.html"
tmplLogin
=
"login.html"
tmplLogin
=
"login.html"
tmplPassword
=
"password.html"
tmplPassword
=
"password.html"
tmplOOB
=
"oob.html"
)
)
const
coreOSLogoURL
=
"https://coreos.com/assets/images/brand/coreos-wordmark-135x40px.png"
const
coreOSLogoURL
=
"https://coreos.com/assets/images/brand/coreos-wordmark-135x40px.png"
...
@@ -23,6 +24,7 @@ var requiredTmpls = []string{
...
@@ -23,6 +24,7 @@ var requiredTmpls = []string{
tmplApproval
,
tmplApproval
,
tmplLogin
,
tmplLogin
,
tmplPassword
,
tmplPassword
,
tmplOOB
,
}
}
// TemplateConfig describes.
// TemplateConfig describes.
...
@@ -106,6 +108,7 @@ func loadTemplates(config TemplateConfig) (*templates, error) {
...
@@ -106,6 +108,7 @@ func loadTemplates(config TemplateConfig) (*templates, error) {
loginTmpl
:
tmpls
.
Lookup
(
tmplLogin
),
loginTmpl
:
tmpls
.
Lookup
(
tmplLogin
),
approvalTmpl
:
tmpls
.
Lookup
(
tmplApproval
),
approvalTmpl
:
tmpls
.
Lookup
(
tmplApproval
),
passwordTmpl
:
tmpls
.
Lookup
(
tmplPassword
),
passwordTmpl
:
tmpls
.
Lookup
(
tmplPassword
),
oobTmpl
:
tmpls
.
Lookup
(
tmplOOB
),
},
nil
},
nil
}
}
...
@@ -120,6 +123,7 @@ type templates struct {
...
@@ -120,6 +123,7 @@ type templates struct {
loginTmpl
*
template
.
Template
loginTmpl
*
template
.
Template
approvalTmpl
*
template
.
Template
approvalTmpl
*
template
.
Template
passwordTmpl
*
template
.
Template
passwordTmpl
*
template
.
Template
oobTmpl
*
template
.
Template
}
}
type
connectorInfo
struct
{
type
connectorInfo
struct
{
...
@@ -175,6 +179,14 @@ func (t *templates) approval(w http.ResponseWriter, state, username, clientName
...
@@ -175,6 +179,14 @@ func (t *templates) approval(w http.ResponseWriter, state, username, clientName
renderTemplate
(
w
,
t
.
approvalTmpl
,
data
)
renderTemplate
(
w
,
t
.
approvalTmpl
,
data
)
}
}
func
(
t
*
templates
)
oob
(
w
http
.
ResponseWriter
,
code
string
)
{
data
:=
struct
{
TemplateConfig
Code
string
}{
t
.
globalData
,
code
}
renderTemplate
(
w
,
t
.
oobTmpl
,
data
)
}
// small io.Writer utilitiy to determine if executing the template wrote to the underlying response writer.
// small io.Writer utilitiy to determine if executing the template wrote to the underlying response writer.
type
writeRecorder
struct
{
type
writeRecorder
struct
{
wrote
bool
wrote
bool
...
...
This diff is collapsed.
Click to expand it.
server/templates_default.go
+
12
−
0
View file @
ea52bf26
...
@@ -313,6 +313,18 @@ var defaultTemplates = map[string]string{
...
@@ -313,6 +313,18 @@ var defaultTemplates = map[string]string{
</div>
</div>
{{ template "footer.html" . }}
`
,
"oob.html"
:
`{{ template "header.html" . }}
<div class="panel">
<h2 class="heading">Login Successful</h2>
Please copy this code, switch to your application and paste it there:
<br/>
<input type="text" value="{{ .Code }}" />
</div>
{{ template "footer.html" . }}
{{ template "footer.html" . }}
`
,
`
,
"password.html"
:
`{{ template "header.html" . }}
"password.html"
:
`{{ template "header.html" . }}
...
...
This diff is collapsed.
Click to expand it.
web/templates/oob.html
0 → 100644
+
11
−
0
View file @
ea52bf26
{{ template "header.html" . }}
<div
class=
"panel"
>
<h2
class=
"heading"
>
Login Successful
</h2>
Please copy this code, switch to your application and paste it there:
<br/>
<input
type=
"text"
value=
"{{ .Code }}"
/>
</div>
{{ template "footer.html" . }}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment