Skip to content

Commit 1d3c588

Browse files
MOSIP-45087 - Updated the regex for fetching OTP from SMTP
Signed-off-by: Mohanachandran S <mohanachandran.s@technoforte.co.in>
1 parent 0cda784 commit 1d3c588

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

apitest-commons/src/main/java/io/mosip/testrig/apirig/utils/NotificationListener.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ public final class NotificationListener {
1919
private static final int MAX_QUEUE_SIZE = 50;
2020
private static final long INACTIVE_EXPIRY_MS = Long.parseLong(ConfigManager.getproperty("otp_queue_inactive_expiry_time")) * 60 * 1000; // 15 mins
2121
private static final Pattern OTP_PATTERN = Pattern.compile(
22-
"(?i)(?:\\bis\\s+(\\d{6})\\s+and\\s+is\\s+valid|\\buse\\s+(?:otp\\s+)?(\\d{6})\\b)");
22+
"(?i)(?:" +
23+
"\\bis\\s+(\\d{6})\\s+and\\s+is\\s+valid" + // English: "is XXXXXX and is valid"
24+
"|\\buse\\s+(?:otp\\s+)?(\\d{6})\\b" + // English: "Use [OTP] XXXXXX"
25+
"|\\bOTP\\b.*?(\\d{6})(?!\\d)" + // Multilingual: OTP keyword + nearest 6 digits
26+
")");
2327
private static final ConcurrentHashMap<String, EmailQueue> otpQueues = new ConcurrentHashMap<>();
2428

2529
private static final ConcurrentHashMap<String, EmailQueue> notificationQueues = new ConcurrentHashMap<>();

0 commit comments

Comments
 (0)