requestPasswordReset
AppDelegate.reachfive().requestPasswordReset( // Optional arguments email, phoneNumber, redirectUrl )
Description
Request a password reset for a profile. It will send an email if the email address is provided and an SMS if the phone number is given.
It is required to configure and to enable the Password reset email or the Password reset SMS templates in the account’s settings.
Examples
AppDelegate
.reachfive()
.requestPasswordReset(
email: "john.doe@gmail.com",
redirectUrl: "https://example-password-reset.com"
)
.onSuccess { _ in
// Do something
}
.onFailure { error in
// Return a ReachFive error
}
AppDelegate
.reachfive()
.requestPasswordReset(phoneNumber: "+33682234940")
.onSuccess { _ in
// Do something
}
.onFailure { error in
// Return a ReachFive error
}
Parameters
Parameter | Description | ||
---|---|---|---|
The email address of the profile. |
|||
The URL to which the user is redirected.
|
|||
The phone number of the profile. Both the international format and the national conventions of the account’s country are accepted if configured in account settings. |
Response
Type: Future<(), ReachFiveError>
The profile will receive an email or an SMS. If the identifier is invalid or if the templates are incomplete, the promise will be rejected and will return a ReachFiveError
.
ReachFiveError
Based on the problem, the ReachFiveError
will be:
-
AuthCanceled
: The user cancelled the request or no credential was available in the keychain. -
RequestError(apiError: ApiError)
for a Bad Request (status 400) error. -
AuthFailure(reason: String, apiError: ApiError?)
mainly for Unauthorized (status 401) error. -
TechnicalError(reason: String, apiError: ApiError?)
if it’s an Internal Server Error (status 500) or other internal errors.
ApiError
error |
The main error message. |
||||||
errorId |
The identifier of the error. |
||||||
errorUserMsg |
The user-friendly error message.
|
||||||
errorMessageKey |
The error message key. |
||||||
errorDescription |
The technical error message. |
||||||
errorDetails FieldError[] |
|