1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

fix(oauth): if username is empty, fail to login (#4232)

* fix(oauth): if username is empty, fail to login

* fix(oauth): return err when failing to find username

* fix(oauth): disable autofill
This commit is contained in:
Chaim Lev-Ari 2020-08-18 15:38:58 +03:00 committed by GitHub
parent b3b706d88d
commit 35fa9d6981
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View file

@ -35,8 +35,7 @@ func (handler *Handler) authenticateOAuth(code string, settings *portainer.OAuth
username, err := handler.OAuthService.Authenticate(code, settings)
if err != nil {
log.Printf("[DEBUG] - Unable to authenticate user via OAuth: %v", err)
return "", nil
return "", err
}
return username, nil

View file

@ -88,6 +88,13 @@ func getUsername(token string, configuration *portainer.OAuthSettings) (string,
}
username := values.Get(configuration.UserIdentifier)
if username == "" {
return username, &oauth2.RetrieveError{
Response: resp,
Body: body,
}
}
return username, nil
}