Merge pull request #1576 from flant/icons-proposal

Pick icons on login screen by connector type instead of ID
This commit is contained in:
Márk Sági-Kazár 2019-12-23 13:05:19 +01:00 committed by GitHub
commit 789272a0c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 7 deletions

View file

@ -259,16 +259,15 @@ func (s *Server) handleAuthorization(w http.ResponseWriter, r *http.Request) {
} }
connectorInfos := make([]connectorInfo, len(connectors)) connectorInfos := make([]connectorInfo, len(connectors))
i := 0 for index, conn := range connectors {
for _, conn := range connectors { connectorInfos[index] = connectorInfo{
connectorInfos[i] = connectorInfo{
ID: conn.ID, ID: conn.ID,
Name: conn.Name, Name: conn.Name,
Type: conn.Type,
// TODO(ericchiang): Make this pass on r.URL.RawQuery and let something latter // TODO(ericchiang): Make this pass on r.URL.RawQuery and let something latter
// on create the auth request. // on create the auth request.
URL: s.absPath("/auth", conn.ID) + "?req=" + authReq.ID, URL: s.absPath("/auth", conn.ID) + "?req=" + authReq.ID,
} }
i++
} }
if err := s.templates.login(r, w, connectorInfos, r.URL.Path); err != nil { if err := s.templates.login(r, w, connectorInfos, r.URL.Path); err != nil {

View file

@ -233,6 +233,7 @@ type connectorInfo struct {
ID string ID string
Name string Name string
URL string URL string
Type string
} }
type byName []connectorInfo type byName []connectorInfo

View file

@ -68,12 +68,12 @@ body {
background-size: contain; background-size: contain;
} }
.dex-btn-icon--bitbucket { .dex-btn-icon--bitbucket-cloud {
background-color: #205081; background-color: #205081;
background-image: url(../static/img/bitbucket-icon.svg); 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-color: #84B6EF;
background-image: url(../static/img/ldap-icon.svg); background-image: url(../static/img/ldap-icon.svg);
} }

View file

@ -7,7 +7,7 @@
<div class="theme-form-row"> <div class="theme-form-row">
<a href="{{ $c.URL }}" target="_self"> <a href="{{ $c.URL }}" target="_self">
<button class="dex-btn theme-btn-provider"> <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> <span class="dex-btn-text">Log in with {{ $c.Name }}</span>
</button> </button>
</a> </a>