diff --git a/app/Controllers/Abha.php b/app/Controllers/Abha.php index 9d1a56c..2717016 100644 --- a/app/Controllers/Abha.php +++ b/app/Controllers/Abha.php @@ -1187,7 +1187,7 @@ class Abha extends BaseController } if (empty($result['ok']) || (int) $result['ok'] !== 1) { - $err = $this->extractBridgeErrorText($result, 'Incorrect OTP'); + $err = $this->extractBridgeErrorText($result, 'Please enter a valid OTP. Entered OTP is either expired or incorrect.'); if (stripos($err, 'no abha') !== false || stripos($err, 'not registered') !== false || stripos($err, 'not exist') !== false || stripos($err, 'not found') !== false) { return $this->response->setJSON([ 'ok' => 0, @@ -1234,7 +1234,9 @@ class Abha extends BaseController ); // VRFY_ABHA_403: No ABHA user registered with this Aadhaar Number - $isNew = ! empty($payload['is_new']) || ! empty($payload['new_user']) || ! empty($result['new_user']); + $isNew = ! empty($payload['is_new']) || ! empty($payload['new_user']) || ! empty($result['new_user']) + || (isset($payload['isNew']) && ($payload['isNew'] === true || $payload['isNew'] === 'true')) + || (isset($payload['new']) && ($payload['new'] === true || $payload['new'] === 'true')); if ((strlen($cleanAbha) !== 14 && $abhaAddress === '') || $isNew) { return $this->response->setJSON([ 'ok' => 0, diff --git a/app/Libraries/Abdm/EAtriaBridgeConnector.php b/app/Libraries/Abdm/EAtriaBridgeConnector.php index 3130286..ef59f3f 100644 --- a/app/Libraries/Abdm/EAtriaBridgeConnector.php +++ b/app/Libraries/Abdm/EAtriaBridgeConnector.php @@ -1080,7 +1080,7 @@ class EAtriaBridgeConnector implements AbdmConnectorInterface $authResult = strtolower(trim((string) ($result['authResult'] ?? $result['data']['authResult'] ?? $result['auth_result'] ?? $result['data']['auth_result'] ?? ''))); $status = strtolower(trim((string) ($result['status'] ?? $result['data']['status'] ?? ''))); if ($authResult === 'failed' || in_array($status, ['failed', 'failure', 'error'], true)) { - $err = trim((string) ($result['message'] ?? $result['data']['message'] ?? $result['error_text'] ?? 'Please enter a valid OTP. Entered OTP is either expired or incorrect.')); + $err = trim((string) ($result['error_text'] ?? $result['message'] ?? $result['data']['message'] ?? 'Please enter a valid OTP. Entered OTP is either expired or incorrect.')); return array_merge($result, [ 'ok' => 0, 'error_text' => $err !== '' ? $err : 'Please enter a valid OTP. Entered OTP is either expired or incorrect.', diff --git a/app/Views/partials/abha_aadhaar_modal.php b/app/Views/partials/abha_aadhaar_modal.php index c60f387..557fe7c 100644 --- a/app/Views/partials/abha_aadhaar_modal.php +++ b/app/Views/partials/abha_aadhaar_modal.php @@ -405,9 +405,9 @@ window.AbhaAadhaarModal = (function () { } if (!res || res.ok != 1) { - var err = (res && res.error_text) ? res.error_text : 'Incorrect OTP'; - if (/incorrect|invalid|fail/i.test(err)) { - err = 'Incorrect OTP'; + var err = (res && res.error_text) ? res.error_text : 'Verification failed. Please try again.'; + if (/incorrect\s*otp|otp\s*is\s*(either\s*)?incorrect|invalid\s*otp/i.test(err)) { + err = 'Incorrect OTP. Please enter the valid OTP received on your Aadhaar-linked mobile.'; } alertBox('danger', escapeHtml(err)); return; @@ -417,12 +417,15 @@ window.AbhaAadhaarModal = (function () { renderProfile(res); }, 'json').fail(function (xhr) { btn.prop('disabled', false).html('Verify OTP & Fetch Profile'); - var err = (xhr.responseJSON && xhr.responseJSON.error_text) ? xhr.responseJSON.error_text : 'Incorrect OTP'; if (xhr.responseJSON && xhr.responseJSON.no_abha_found) { alertBox('warning', 'NO ABHA user registered with this Aadhaar Number'); $('#abhaAadhaarNotFoundCard').removeClass('d-none'); return; } + var err = (xhr.responseJSON && xhr.responseJSON.error_text) ? xhr.responseJSON.error_text : 'Verification failed. Please try again.'; + if (/incorrect\s*otp|otp\s*is\s*(either\s*)?incorrect|invalid\s*otp/i.test(err)) { + err = 'Incorrect OTP. Please enter the valid OTP received on your Aadhaar-linked mobile.'; + } alertBox('danger', escapeHtml(err)); }); }