fix(cli): add +91 prefix automatically for login
Description
Problem
The CLI login flow required users to manually include the +91 country code while entering their mobile number.
However, in the GUI application, the +91 prefix is automatically added on the client side.
This mismatch caused:
- Login failures for CLI users
- Confusion for users familiar with the GUI
Solution
Updated the CLI login implementation to normalize phone number input:
- Accepts 10-digit mobile numbers from users
- Automatically prepends
+91if the prefix is missing
Before vs After
| Scenario | Before | After |
|---|---|---|
| User Input | 9876543210 | 9876543210 |
| Sent to API | 9876543210 | +919876543210 |
| Result | Login failed | Login success |
Changes Made
- Updated input label:
Phone number→Phone number (+91) - Added logic to prepend
+91if not already present - Ensured compatibility for numbers already containing
+91
Impact
- Aligns CLI behavior with GUI
- Improves user experience
- Prevents login failures due to format mismatch
Testing
Test Cases:
-
Input:
9876543210- Expected:
+919876543210sent to API
- Expected:
-
Input:
+919876543210- Expected: remains unchanged
Edited by POORNA CHANDRA SAI TEJA KUMPATLA