resetPassword method
Implementation
Future<Map<String, dynamic>?> resetPassword(
String email, String csrfToken, String referer) async {
var body = {"email": email};
String formData = body.keys
.map((key) =>
"${Uri.encodeComponent(key)}=${Uri.encodeComponent(body[key].toString())}")
.join("&");
final response = await http.post(
Uri.parse('$edxBaseUrl/account/password'),
headers: {
"X-CSRFToken": csrfToken,
'Cookie':
'csrftoken=${csrfToken}; sessionid=1|rpowif7xbl8oum4bb3gr8ka02rwxzr1l|VcdGdiWGvnoo|IjUxZjUwZTk5NGM5NGQ0YmExMGYzMDRlNjgwOGIwZTFiODlmZWE3MTQwMTUxZWUxZDA2OTY5YTZlYjMxNTYyMDQi:1s9sYX:3zhPfch8Jwc8YXGuJseQFsiBsGc; csrftoken=${csrfToken}',
'Content-Type': 'application/x-www-form-urlencoded',
"Referer": referer
},
body: formData,
);
if (response.statusCode == 200) {
return {
"message":
"Please check your email for instructions to reset your password"
};
}
var data = json.decode(response.body);
return data; // Returns the API response
}