aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-22 23:48:56 -0400
committerpg9182 <96569817+pg9182@users.noreply.github.com>2022-10-22 23:48:56 -0400
commit109746880ba8c9bf8271eebfcf605c337c2e32c2 (patch)
treee1d17089ec5d85d43bb2b313821db1ad44107359
parentd2ac8b85ff21b85d24cae3018b7b2baf001cf193 (diff)
downloadAtlas-109746880ba8c9bf8271eebfcf605c337c2e32c2.tar.gz
Atlas-109746880ba8c9bf8271eebfcf605c337c2e32c2.zip
pkg/origin: Return an error if there is a 2fa prompt during login
-rw-r--r--pkg/origin/login.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/pkg/origin/login.go b/pkg/origin/login.go
index 3ba61b0..553fefc 100644
--- a/pkg/origin/login.go
+++ b/pkg/origin/login.go
@@ -403,6 +403,9 @@ func login2(ctx context.Context, c *http.Client, r1 *http.Request) (*http.Reques
m := login2re.FindSubmatch(buf)
if m == nil {
if doc, err := html.Parse(bytes.NewReader(buf)); err == nil {
+ if form := cascadia.Query(doc, cascadia.MustCompile(`form#loginForm #tfa-login`)); form != nil {
+ return nil, false, fmt.Errorf("submit login form: needs 2fa code")
+ }
if form := cascadia.Query(doc, cascadia.MustCompile(`form#tosForm`)); form != nil {
submitURL := &url.URL{
Scheme: "https",