diff --git a/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/config/servlet/ForwardToLoginServlet.java b/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/config/servlet/ForwardToLoginServlet.java index e817463ad..aa419fb41 100644 --- a/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/config/servlet/ForwardToLoginServlet.java +++ b/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/config/servlet/ForwardToLoginServlet.java @@ -70,18 +70,25 @@ public final class ForwardToLoginServlet extends AbstractRedirectionServlet { logger.warn("Request is missing client ID."); return getErrorRedirectionUrl(PairAccountServlet.MISSING_CLIENT_ID_PARAMETER_NAME); } + clientId = clientId.strip(); + if (clientSecret == null || clientSecret.isEmpty()) { logger.warn("Request is missing client secret."); return getErrorRedirectionUrl(PairAccountServlet.MISSING_CLIENT_SECRET_PARAMETER_NAME); } + clientSecret = clientSecret.strip(); + if (bridgeId == null || bridgeId.isEmpty()) { logger.warn("Request is missing bridge ID."); return getErrorRedirectionUrl(PairAccountServlet.MISSING_BRIDGE_ID_PARAMETER_NAME); } + bridgeId = bridgeId.strip(); + if (email == null || email.isEmpty()) { logger.warn("Request is missing e-mail address."); return getErrorRedirectionUrl(PairAccountServlet.MISSING_EMAIL_PARAMETER_NAME); } + email = email.strip(); ThingUID bridgeUid = null; try { diff --git a/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/util/EmailValidator.java b/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/util/EmailValidator.java index 4e4083f85..5cd7143b1 100644 --- a/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/util/EmailValidator.java +++ b/bundles/org.openhab.binding.mielecloud/src/main/java/org/openhab/binding/mielecloud/internal/util/EmailValidator.java @@ -23,7 +23,8 @@ import org.eclipse.jdt.annotation.NonNullByDefault; */ @NonNullByDefault public final class EmailValidator { - private static final Pattern EMAIL_PATTERN = Pattern.compile("^[\\w-_\\.+]*[\\w-_\\.]\\@([\\w]+\\.)+[\\w]+[\\w]$"); + private static final Pattern EMAIL_PATTERN = Pattern + .compile("^[a-zA-Z_0-9\\.+%-]{3,}\\@([a-zA-Z_0-9-]+\\.)+[a-z]+$"); private EmailValidator() { throw new UnsupportedOperationException(); diff --git a/bundles/org.openhab.binding.mielecloud/src/main/resources/org/openhab/binding/mielecloud/internal/config/pairing.html b/bundles/org.openhab.binding.mielecloud/src/main/resources/org/openhab/binding/mielecloud/internal/config/pairing.html index ea1017555..4565122e4 100644 --- a/bundles/org.openhab.binding.mielecloud/src/main/resources/org/openhab/binding/mielecloud/internal/config/pairing.html +++ b/bundles/org.openhab.binding.mielecloud/src/main/resources/org/openhab/binding/mielecloud/internal/config/pairing.html @@ -53,7 +53,7 @@