Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pick icons on login screen by connector type instead of ID #1576

Merged
merged 1 commit into from
Dec 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,16 +259,15 @@ func (s *Server) handleAuthorization(w http.ResponseWriter, r *http.Request) {
}

connectorInfos := make([]connectorInfo, len(connectors))
i := 0
for _, conn := range connectors {
connectorInfos[i] = connectorInfo{
for index, conn := range connectors {
connectorInfos[index] = connectorInfo{
ID: conn.ID,
sagikazarmark marked this conversation as resolved.
Show resolved Hide resolved
Name: conn.Name,
Type: conn.Type,
// TODO(ericchiang): Make this pass on r.URL.RawQuery and let something latter
// on create the auth request.
URL: s.absPath("/auth", conn.ID) + "?req=" + authReq.ID,
}
i++
}

if err := s.templates.login(r, w, connectorInfos, r.URL.Path); err != nil {
Expand Down
1 change: 1 addition & 0 deletions server/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ type connectorInfo struct {
ID string
Name string
URL string
Type string
}

type byName []connectorInfo
Expand Down
4 changes: 2 additions & 2 deletions web/static/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ body {
background-size: contain;
}

.dex-btn-icon--bitbucket {
.dex-btn-icon--bitbucket-cloud {
background-color: #205081;
background-image: url(../static/img/bitbucket-icon.svg);
}

.dex-btn-icon--ldap, .dex-btn-icon--tectonic-ldap {
.dex-btn-icon--ldap {
background-color: #84B6EF;
background-image: url(../static/img/ldap-icon.svg);
}
Expand Down
2 changes: 1 addition & 1 deletion web/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h2 class="theme-heading">Log in to {{ issuer }} </h2>
<div class="theme-form-row">
<a href="{{ $c.URL }}" target="_self">
<button class="dex-btn theme-btn-provider">
<span class="dex-btn-icon dex-btn-icon--{{ $c.ID }}"></span>
<span class="dex-btn-icon dex-btn-icon--{{ $c.Type }}"></span>
<span class="dex-btn-text">Log in with {{ $c.Name }}</span>
</button>
</a>
Expand Down