From c59af0375f19063c69aa2978deb3a812abcaf16b Mon Sep 17 00:00:00 2001 From: Michael Palmer Date: Tue, 27 Oct 2020 09:24:24 -0400 Subject: [PATCH 1/2] check for errors from ping --- pkg/provider/pingfed/pingfed.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/provider/pingfed/pingfed.go b/pkg/provider/pingfed/pingfed.go index 3c2c3063d..d1b1fdd12 100644 --- a/pkg/provider/pingfed/pingfed.go +++ b/pkg/provider/pingfed/pingfed.go @@ -215,6 +215,13 @@ func (ac *Client) handleLogin(ctx context.Context, doc *goquery.Document) (conte return ctx, nil, fmt.Errorf("no context value for 'login'") } + // Check for errors from Ping + pingErrors := doc.Find("form>.ping-messages>.ping-error") + if pingErrors.Size() == 1 { + errorContent := pingErrors.Text() + return ctx, nil, errors.New(errorContent) + } + if loginAttempt > 1 { // Password was not accepted. Re-prompt for login details log.Println("Invalid username or password") From 1940007ca5d995a5e3887c5b8acfe06cdce559ea Mon Sep 17 00:00:00 2001 From: Michael Palmer Date: Tue, 27 Oct 2020 09:24:37 -0400 Subject: [PATCH 2/2] check for errors from ping --- pkg/provider/pingfed/pingfed.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/provider/pingfed/pingfed.go b/pkg/provider/pingfed/pingfed.go index d1b1fdd12..70882978d 100644 --- a/pkg/provider/pingfed/pingfed.go +++ b/pkg/provider/pingfed/pingfed.go @@ -218,8 +218,7 @@ func (ac *Client) handleLogin(ctx context.Context, doc *goquery.Document) (conte // Check for errors from Ping pingErrors := doc.Find("form>.ping-messages>.ping-error") if pingErrors.Size() == 1 { - errorContent := pingErrors.Text() - return ctx, nil, errors.New(errorContent) + return ctx, nil, errors.New(pingErrors.Text()) } if loginAttempt > 1 {