mirror of https://github.com/portainer/portainer
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 autofillpull/4234/head
parent
b3b706d88d
commit
35fa9d6981
|
@ -35,8 +35,7 @@ func (handler *Handler) authenticateOAuth(code string, settings *portainer.OAuth
|
||||||
|
|
||||||
username, err := handler.OAuthService.Authenticate(code, settings)
|
username, err := handler.OAuthService.Authenticate(code, settings)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[DEBUG] - Unable to authenticate user via OAuth: %v", err)
|
return "", err
|
||||||
return "", nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return username, nil
|
return username, nil
|
||||||
|
|
|
@ -88,6 +88,13 @@ func getUsername(token string, configuration *portainer.OAuthSettings) (string,
|
||||||
}
|
}
|
||||||
|
|
||||||
username := values.Get(configuration.UserIdentifier)
|
username := values.Get(configuration.UserIdentifier)
|
||||||
|
if username == "" {
|
||||||
|
return username, &oauth2.RetrieveError{
|
||||||
|
Response: resp,
|
||||||
|
Body: body,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return username, nil
|
return username, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
Client secret
|
Client secret
|
||||||
</label>
|
</label>
|
||||||
<div class="col-sm-9 col-lg-10">
|
<div class="col-sm-9 col-lg-10">
|
||||||
<input type="password" class="form-control" id="oauth_client_secret" ng-model="$ctrl.settings.ClientSecret" placeholder="xxxxxxxxxxxxxxxxxxxx" />
|
<input type="password" class="form-control" id="oauth_client_secret" ng-model="$ctrl.settings.ClientSecret" placeholder="xxxxxxxxxxxxxxxxxxxx" autocomplete="new-password" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue