Mih AUth Forgot and Reset router update

This commit is contained in:
2025-08-26 19:06:40 +02:00
parent e6942c4006
commit aa54cf054f
7 changed files with 840 additions and 70 deletions

View File

@@ -114,6 +114,54 @@ class MihAuthenticationServices {
}
}
Future<bool> forgotPassword(
String email,
) async {
var response = await http.post(
Uri.parse("$baseAPI/auth/user/password/reset/token"),
body: '{"formFields": [{"id": "email","value": "$email"}]}',
headers: {
'Content-type': 'application/json',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
var userSignedin = jsonDecode(response.body);
if (userSignedin["status"] == "OK") {
return true;
} else {
return false;
}
} else {
return false;
}
}
Future<bool> resetPassword(
String token,
String password,
) async {
var response = await http.post(
Uri.parse("$baseAPI/auth/user/password/reset"),
body:
'{"method": "token","formFields": [{"id": "password","value": "$password"}],"token": "$token"}',
headers: {
'Content-type': 'application/json',
'Accept': 'application/json',
},
);
if (response.statusCode == 200) {
var userSignedin = jsonDecode(response.body);
if (userSignedin["status"] == "OK") {
return true;
} else {
return false;
}
} else {
return false;
}
}
void internetConnectionPopUp(BuildContext context) {
showDialog(
context: context,