From 6a01bc630d40e9623a58d6b9da4218389d7a6b1f Mon Sep 17 00:00:00 2001 From: Jakob Heher Date: Thu, 1 Sep 2022 10:24:30 +0200 Subject: do not remove whitespace from idA usernames --- .../main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java | 8 +++++--- .../pdfover/gui/composites/MobileBKUEnterNumberComposite.java | 2 -- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'pdf-over-gui/src/main') diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java index f6de0789..88a38a0e 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java @@ -201,10 +201,12 @@ public class MobileBKUHelper { public static String normalizeMobileNumber(String number) { // Verify number and normalize - number = number.replaceAll("\\s",""); + number = number.trim(); + + String numberWithoutWhitespace = number.replaceAll("\\s",""); // Compile and use regular expression Pattern pattern = Pattern.compile(NUMBER_REGEX); - Matcher matcher = pattern.matcher(number); + Matcher matcher = pattern.matcher(numberWithoutWhitespace); if (!matcher.find()) return number; /* might be an idA username, return unchanged */ @@ -219,7 +221,7 @@ public class MobileBKUHelper { if (countryCode.equals("10301")) { // A-Trust Testnumber! Don't change - return number; + return numberWithoutWhitespace; } countryCode = countryCode.replace("00", "+"); diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java index 427daefd..2a5b3e9c 100644 --- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java +++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java @@ -60,8 +60,6 @@ public class MobileBKUEnterNumberComposite extends StateComposite { try { String number = MobileBKUEnterNumberComposite.this.txt_number.getText(); - number = number.replaceAll("\\s",""); - MobileBKUEnterNumberComposite.this.setMobileNumber(number); String password = MobileBKUEnterNumberComposite.this.txt_password.getText(); -- cgit v1.2.3