You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/03/26 10:00:19 UTC

[camel] branch master updated: CAMEL-13365: camel-box - Ambiguous error message when authentication requires CAPTCHA

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 2f83775  CAMEL-13365: camel-box - Ambiguous error message when authentication requires CAPTCHA
2f83775 is described below

commit 2f83775847489d248a48d4bf0f88a7804ff60abb
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Tue Mar 26 14:45:05 2019 +0900

    CAMEL-13365: camel-box - Ambiguous error message when authentication requires CAPTCHA
---
 .../apache/camel/component/box/internal/BoxConnectionHelper.java   | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/internal/BoxConnectionHelper.java b/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/internal/BoxConnectionHelper.java
index 05ba39a..c3b34d1 100644
--- a/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/internal/BoxConnectionHelper.java
+++ b/components/camel-box/camel-box-component/src/main/java/org/apache/camel/component/box/internal/BoxConnectionHelper.java
@@ -183,10 +183,17 @@ public final class BoxConnectionHelper {
 
     /**
      * Validation of page:
+     * - detects CAPTCHA test
      * - detects invalid credentials error
      * - detects wrong clientId error
      */
     private static void validatePage(Document page) {
+        Elements captchaDivs = page.select("div[class*=g-recaptcha]");
+        if (!captchaDivs.isEmpty()) {
+            throw new IllegalArgumentException(
+                    "Authentication requires CAPTCHA test. First you need to authenticate the account manually via web to unlock CAPTCHA.");
+        }
+
         Elements errorDivs = page.select("div[class*=error_message]");
         String errorMessage = null;
         if (!errorDivs.isEmpty()) {