Update: 2026-06-26 01:17:02
This commit is contained in:
@@ -279,6 +279,7 @@ class CRUD {
|
|||||||
var payload = {
|
var payload = {
|
||||||
'fingerprint': _getFpHeader(),
|
'fingerprint': _getFpHeader(),
|
||||||
'password': box.read(BoxName.password) ?? '',
|
'password': box.read(BoxName.password) ?? '',
|
||||||
|
'email': box.read(BoxName.email) ?? '',
|
||||||
'aud': 'service',
|
'aud': 'service',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,21 @@ class LoginController extends GetxController {
|
|||||||
if (res != 'failure' && res is Map && res['status'] == 'success') {
|
if (res != 'failure' && res is Map && res['status'] == 'success') {
|
||||||
var d = res['message']; // V1 returns {status, message: {jwt, data: {user...}}}
|
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
|
// Request OTP from unified module
|
||||||
String phone = d['data']['phone'] ?? '';
|
String phone = d['data']['phone'] ?? '';
|
||||||
bool otpSent = await _sendOtp(phone);
|
bool otpSent = await _sendOtp(phone);
|
||||||
@@ -73,7 +88,7 @@ class LoginController extends GetxController {
|
|||||||
'user_type': 'service'
|
'user_type': 'service'
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
return response != 'failure';
|
return response is Map && response['status'] == 'success';
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Log.print('OTP SEND ERROR: $e');
|
Log.print('OTP SEND ERROR: $e');
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user