Yes. Check what API official web app is using and do the same thing.
Thank you, I've found this:
response = await fetch('/api/password/reset', {
method: 'POST',
body: new URLSearchParams(`email=${encodeURIComponent(email)}`),
You can also just look at network requests using your browser network tool, which is much easier than searching the code.
Can somebody help me with this code in dart/flutter for password reset?
static Future<http.Response> passwordReset(String email) async {
headers['content-type'] = "application/json; charset=utf-8";
headers['Accept'] = "application/json";
String request = json.encode("email=" + Uri.encodeQueryComponent(email));
final response = await http.post(
Uri.parse("https://mytraccarserver.com/api/password/reset"),
body: request,
headers: headers
);
return response;
}
Now the response is "Unsupported Media Type"
Content type is obviously wrong. Have you checked what official web app sends as I recommended? Please provide it here.
Ok solved, thank you.
The correct lines are:
headers['content-type'] = "application/x-www-form-urlencoded; charset=UTF-8";
String request = "email=" + Uri.encodeQueryComponent(email);
Hi Anton,
Is there an API available for the forgot password feature? While using the user edit API (/api/users/{user_id}
) with the PUT method, we also need to pass the JSESSION ID, which requires the user to authenticate.
Is there any alternative or scope for implementing the forgot password feature without requiring prior authentication? other than directly editing the DB
Yes, there is. Check what the official app is doing.
I could find any forgot password option in the web app, could you please correct if I am referring the wrong item ?
Thank you
Have you enabled email in the config?
No, I believe. Email in the config means this one
ldap.mailAttribute
No, email means SMTP configuration.
No, we didn't set any smtp configurations.
Are you referring this attribute : mail.smtp.systemOnly (This is not present in our config file). Could you please let me know what value we have to enter here. ?
Hi,
is there any option to send a pasword reset email from API or by http parameters POST or GET?
Thank you!