forgotPassword method
Initiates password reset process.
This method starts the password reset flow by sending a password reset email to the user. The email will contain a challenge token that can be used to actually reset the password using the resetPassword method.
Parameters
email: The email address of the user requesting password resetdoNotNotify: If true, suppresses sending the password reset email
Returns
A Future that resolves to a record containing:
challengeToken: Token to use for resetting the password
Throws
HttpExceptionif there's a network errorCalljmpExceptionif the email is not found or invalid
Example
final reset = await calljmp.users.auth.email.forgotPassword(
email: 'user@example.com',
);
// User will receive an email with the challenge token
print('Password reset initiated: ${reset.challengeToken}');
Implementation
Future<({String challengeToken})> forgotPassword({
String? email,
bool? doNotNotify,
}) => http
.request("${_config.serviceUrl}/users/auth/email/password")
.use(http.context(_config))
.use(http.access())
.post({"email": email, "doNotNotify": doNotNotify})
.json((json) => (challengeToken: json["challengeToken"]));