updatePassword method
Updates the given username
's password
validating the
change with the given code
Implementation
@override
Future<void> updatePassword(
String username,
String password,
String code,
) async {
try {
final result = await _amplifyAuth.confirmResetPassword(
username: username,
newPassword: password,
confirmationCode: code,
);
_logger.fine('Successfully initiated reset password flow: $result');
} on aws_cognito.CodeMismatchException catch (e) {
throw InvalidCodeException(
message: e.message,
innerException: e,
innerStackTrace: StackTrace.current,
);
} on aws_cognito.ExpiredCodeException catch (e) {
throw ExpiredCodeException(
message: e.message,
innerException: e,
innerStackTrace: StackTrace.current,
);
} on aws_cognito.AuthException catch (e) {
throw UpdatePasswordException(
message: 'failed to update password for user $username',
innerException: e,
innerStackTrace: StackTrace.current,
);
}
}