verifyPasswordResetCode method
Future<String>
verifyPasswordResetCode(
- Session session, {
- required UuidValue passwordResetRequestId,
- required String verificationCode,
- Transaction? transaction,
Verifies a password reset code and returns a finishPasswordResetToken that can be used to finish the password reset.
Throws an EmailAccountPasswordResetException in case of errors, with reason:
- EmailAccountPasswordResetExceptionReason.expired if the password reset request has already expired.
- EmailAccountPasswordResetExceptionReason.tooManyAttempts if the user has made too many attempts trying to verify the password reset.
- EmailAccountPasswordResetExceptionReason.invalid if no request exists
for the given
passwordResetRequestIdorverificationCodeis invalid.
If multiple steps are required to complete the password reset, this endpoint should be overridden to return credentials for the next step instead of the credentials for setting the password.
Implementation
Future<String> verifyPasswordResetCode(
final Session session, {
required final UuidValue passwordResetRequestId,
required final String verificationCode,
final Transaction? transaction,
}) async {
return DatabaseUtil.runInTransactionOrSavepoint(
session.db,
transaction,
(final transaction) => EmailIdpUtils.withReplacedServerEmailException(
() async {
return await utils.passwordReset.verifyPasswordResetCode(
session,
passwordResetRequestId: passwordResetRequestId,
verificationCode: verificationCode,
transaction: transaction,
);
},
),
);
}