summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Heher <jakob.heher@iaik.tugraz.at>2022-09-01 10:24:30 +0200
committerJakob Heher <jakob.heher@iaik.tugraz.at>2022-09-01 10:24:30 +0200
commit6a01bc630d40e9623a58d6b9da4218389d7a6b1f (patch)
treea9d4d260f9ba0a377698f3bfa24641dc163f0029
parent65fbf0f1bd2174c64d6adc06d0c5d76739fcd98c (diff)
downloadpdf-over-6a01bc630d40e9623a58d6b9da4218389d7a6b1f.tar.gz
pdf-over-6a01bc630d40e9623a58d6b9da4218389d7a6b1f.tar.bz2
pdf-over-6a01bc630d40e9623a58d6b9da4218389d7a6b1f.zip
do not remove whitespace from idA usernames
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/bku/mobile/MobileBKUHelper.java8
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/MobileBKUEnterNumberComposite.java2
2 files changed, 5 insertions, 5 deletions
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();