handlers/connector_login: check before update (optimization)
Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
		@@ -224,6 +224,7 @@ func (s *Server) handleConnectorLogin(w http.ResponseWriter, r *http.Request) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Set the connector being used for the login.
 | 
						// Set the connector being used for the login.
 | 
				
			||||||
 | 
						if authReq.ConnectorID != connID {
 | 
				
			||||||
		updater := func(a storage.AuthRequest) (storage.AuthRequest, error) {
 | 
							updater := func(a storage.AuthRequest) (storage.AuthRequest, error) {
 | 
				
			||||||
			a.ConnectorID = connID
 | 
								a.ConnectorID = connID
 | 
				
			||||||
			return a, nil
 | 
								return a, nil
 | 
				
			||||||
@@ -233,6 +234,7 @@ func (s *Server) handleConnectorLogin(w http.ResponseWriter, r *http.Request) {
 | 
				
			|||||||
			s.renderError(w, http.StatusInternalServerError, "Database error.")
 | 
								s.renderError(w, http.StatusInternalServerError, "Database error.")
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	scopes := parseScopes(authReq.Scopes)
 | 
						scopes := parseScopes(authReq.Scopes)
 | 
				
			||||||
	showBacklink := len(s.connectors) > 1
 | 
						showBacklink := len(s.connectors) > 1
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user