mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:19:17 +03:30
Fix bug in reset pass
This commit is contained in:
+24
-1
@@ -74,6 +74,7 @@ class Auth with ChangeNotifier {
|
|||||||
// } else {
|
// } else {
|
||||||
// return 'Done';
|
// return 'Done';
|
||||||
// }
|
// }
|
||||||
|
|
||||||
print(responseData);
|
print(responseData);
|
||||||
if (responseData['status'] == 'Faild') {
|
if (responseData['status'] == 'Faild') {
|
||||||
return 'wrong';
|
return 'wrong';
|
||||||
@@ -94,7 +95,7 @@ class Auth with ChangeNotifier {
|
|||||||
'password_confirmation': passwordConfirmation,
|
'password_confirmation': passwordConfirmation,
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
'Authorization': User.token,
|
'Authorization': token != 'Bearer null' ? token : User.token,
|
||||||
// 'X-Requested-With': 'XMLHttpRequest',
|
// 'X-Requested-With': 'XMLHttpRequest',
|
||||||
},
|
},
|
||||||
// headers: {'X-Requested-With': 'XMLHttpRequest'},
|
// headers: {'X-Requested-With': 'XMLHttpRequest'},
|
||||||
@@ -110,6 +111,28 @@ class Auth with ChangeNotifier {
|
|||||||
responseData['message'] == 'Success Change Password') {
|
responseData['message'] == 'Success Change Password') {
|
||||||
return 'done';
|
return 'done';
|
||||||
} else {
|
} else {
|
||||||
|
_token = responseData['access_token'];
|
||||||
|
_expiaryDate = DateTime.now().add(
|
||||||
|
Duration(
|
||||||
|
seconds: responseData['expires_in'],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
User.token = _token!;
|
||||||
|
// print(isAuth);
|
||||||
|
|
||||||
|
// print(User.token);
|
||||||
|
var localUser = await getUserData();
|
||||||
|
// print("------ in auth ===========");
|
||||||
|
print(localUser);
|
||||||
|
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
final userData = json.encode({
|
||||||
|
'token': _token,
|
||||||
|
'expiaryDate': _expiaryDate!.toIso8601String(),
|
||||||
|
'user': user
|
||||||
|
});
|
||||||
|
prefs.setString('userData', userData);
|
||||||
|
notifyListeners();
|
||||||
return 'error';
|
return 'error';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user