service 2-5-26-2

This commit is contained in:
Hamza-Ayed
2026-05-02 18:36:59 +03:00
parent 255724418c
commit 98846b8158
14 changed files with 912 additions and 534 deletions

View File

@@ -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();
}
}