Update: 2026-06-26 01:17:02
This commit is contained in:
@@ -279,6 +279,7 @@ class CRUD {
|
||||
var payload = {
|
||||
'fingerprint': _getFpHeader(),
|
||||
'password': box.read(BoxName.password) ?? '',
|
||||
'email': box.read(BoxName.email) ?? '',
|
||||
'aud': 'service',
|
||||
};
|
||||
|
||||
|
||||
@@ -46,6 +46,21 @@ class LoginController extends GetxController {
|
||||
if (res != 'failure' && res is Map && res['status'] == 'success') {
|
||||
var d = res['message']; // V1 returns {status, message: {jwt, data: {user...}}}
|
||||
|
||||
// Save JWT immediately so subsequent CRUD calls don't trigger
|
||||
// unnecessary session refresh (which calls getJWT without email)
|
||||
final jwt = d['jwt'];
|
||||
final hmac = d['hmac'];
|
||||
await box.write(BoxName.jwt, c(jwt));
|
||||
await storage.write(key: BoxName.jwt, value: c(jwt));
|
||||
if (hmac != null) {
|
||||
await box.write(BoxName.hmac, hmac);
|
||||
}
|
||||
await storage.write(key: 'password', value: pass);
|
||||
await box.write(BoxName.password, pass);
|
||||
final emailStr = email.text.trim();
|
||||
await storage.write(key: 'email', value: emailStr);
|
||||
await box.write(BoxName.email, emailStr);
|
||||
|
||||
// Request OTP from unified module
|
||||
String phone = d['data']['phone'] ?? '';
|
||||
bool otpSent = await _sendOtp(phone);
|
||||
@@ -73,7 +88,7 @@ class LoginController extends GetxController {
|
||||
'user_type': 'service'
|
||||
},
|
||||
);
|
||||
return response != 'failure';
|
||||
return response is Map && response['status'] == 'success';
|
||||
} catch (e) {
|
||||
Log.print('OTP SEND ERROR: $e');
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user