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
3eb528f9
Unverified
Commit
3eb528f9
authored
7 years ago
by
Eric Chiang
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1129 from ericchiang/cherry-pick-1123
cherry-pick: show "back" link for password connectors
parents
49d3c0ea
dd677540
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
server/handlers.go
+3
-2
3 additions, 2 deletions
server/handlers.go
server/templates.go
+3
-2
3 additions, 2 deletions
server/templates.go
web/templates/password.html
+5
-0
5 additions, 0 deletions
web/templates/password.html
web/themes/coreos/styles.css
+4
-0
4 additions, 0 deletions
web/themes/coreos/styles.css
with
15 additions
and
4 deletions
server/handlers.go
+
3
−
2
View file @
3eb528f9
...
...
@@ -223,6 +223,7 @@ func (s *Server) handleConnectorLogin(w http.ResponseWriter, r *http.Request) {
return
}
scopes
:=
parseScopes
(
authReq
.
Scopes
)
showBacklink
:=
len
(
s
.
connectors
)
>
1
switch
r
.
Method
{
case
"GET"
:
...
...
@@ -250,7 +251,7 @@ func (s *Server) handleConnectorLogin(w http.ResponseWriter, r *http.Request) {
}
http
.
Redirect
(
w
,
r
,
callbackURL
,
http
.
StatusFound
)
case
connector
.
PasswordConnector
:
if
err
:=
s
.
templates
.
password
(
w
,
r
.
URL
.
String
(),
""
,
usernamePrompt
(
conn
),
false
);
err
!=
nil
{
if
err
:=
s
.
templates
.
password
(
w
,
r
.
URL
.
String
(),
""
,
usernamePrompt
(
conn
),
false
,
showBacklink
);
err
!=
nil
{
s
.
logger
.
Errorf
(
"Server template error: %v"
,
err
)
}
case
connector
.
SAMLConnector
:
...
...
@@ -298,7 +299,7 @@ func (s *Server) handleConnectorLogin(w http.ResponseWriter, r *http.Request) {
return
}
if
!
ok
{
if
err
:=
s
.
templates
.
password
(
w
,
r
.
URL
.
String
(),
username
,
usernamePrompt
(
passwordConnector
),
true
);
err
!=
nil
{
if
err
:=
s
.
templates
.
password
(
w
,
r
.
URL
.
String
(),
username
,
usernamePrompt
(
passwordConnector
),
true
,
showBacklink
);
err
!=
nil
{
s
.
logger
.
Errorf
(
"Server template error: %v"
,
err
)
}
return
...
...
This diff is collapsed.
Click to expand it.
server/templates.go
+
3
−
2
View file @
3eb528f9
...
...
@@ -190,13 +190,14 @@ func (t *templates) login(w http.ResponseWriter, connectors []connectorInfo) err
return
renderTemplate
(
w
,
t
.
loginTmpl
,
data
)
}
func
(
t
*
templates
)
password
(
w
http
.
ResponseWriter
,
postURL
,
lastUsername
,
usernamePrompt
string
,
lastWasInvalid
bool
)
error
{
func
(
t
*
templates
)
password
(
w
http
.
ResponseWriter
,
postURL
,
lastUsername
,
usernamePrompt
string
,
lastWasInvalid
,
showBacklink
bool
)
error
{
data
:=
struct
{
PostURL
string
BackLink
bool
Username
string
UsernamePrompt
string
Invalid
bool
}{
postURL
,
lastUsername
,
usernamePrompt
,
lastWasInvalid
}
}{
postURL
,
showBacklink
,
lastUsername
,
usernamePrompt
,
lastWasInvalid
}
return
renderTemplate
(
w
,
t
.
passwordTmpl
,
data
)
}
...
...
This diff is collapsed.
Click to expand it.
web/templates/password.html
+
5
−
0
View file @
3eb528f9
...
...
@@ -25,6 +25,11 @@
<button
tabindex=
"3"
id=
"submit-login"
type=
"submit"
class=
"dex-btn theme-btn--primary"
>
Login
</button>
</form>
{{ if .BackLink }}
<div
class=
"theme-link-back"
>
<a
class=
"dex-subtle-text"
href=
"javascript:history.back()"
>
Select another login method.
</a>
</div>
{{ end }}
</div>
{{ template "footer.html" . }}
This diff is collapsed.
Click to expand it.
web/themes/coreos/styles.css
+
4
−
0
View file @
3eb528f9
...
...
@@ -107,3 +107,7 @@
text-align
:
left
;
width
:
250px
;
}
.theme-link-back
{
margin-top
:
4px
;
}
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