service 2-5-26-2
This commit is contained in:
@@ -43,11 +43,16 @@ class LoginController extends GetxController {
|
||||
Log.print('📥 Login Response: $res');
|
||||
|
||||
if (res != 'failure' && res is Map && res['status'] == 'success') {
|
||||
var d = res['message']; // V1 returns {status, message: {jwt, data: {user...}}}
|
||||
|
||||
// Store JWT
|
||||
var d = res[
|
||||
'message']; // V1 returns {status, message: {jwt, data: {user...}}}
|
||||
|
||||
// Store JWT & HMAC
|
||||
final jwt = d['jwt'];
|
||||
box.write(BoxName.jwt, c(jwt));
|
||||
final hmac = d['hmac'];
|
||||
await box.write(BoxName.jwt, c(jwt));
|
||||
if (hmac != null) {
|
||||
await box.write(BoxName.hmac, hmac);
|
||||
}
|
||||
|
||||
// Store User Data
|
||||
var userData = d['data'];
|
||||
@@ -72,14 +77,13 @@ class LoginController extends GetxController {
|
||||
void onInit() async {
|
||||
await EncryptionHelper.initialize();
|
||||
await DeviceHelper.getDeviceFingerprint();
|
||||
|
||||
|
||||
// Auto login if credentials exist
|
||||
String? storedPassword = await storage.read(key: 'password');
|
||||
if (storedPassword != null) {
|
||||
login();
|
||||
}
|
||||
|
||||
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user