@@ -194,6 +194,10 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
194
194
}
195
195
ReferenceCountedFutureImpl &futures = auth_data_->future_impl ;
196
196
const auto handle = futures.SafeAlloc <AuthResult>(kUserFn_LinkWithCredential , AuthResult ());
197
+ if (!credential.is_valid ()) {
198
+ futures.Complete (handle, kAuthErrorInvalidCredential , " Invalid credential is not allowed." );
199
+ return MakeFuture (&futures, handle);
200
+ }
197
201
AuthData *auth_data = auth_data_;
198
202
[UserImpl (auth_data)
199
203
linkWithCredential: CredentialFromImpl (credential.impl_)
@@ -209,6 +213,10 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
209
213
}
210
214
ReferenceCountedFutureImpl &futures = auth_data_->future_impl ;
211
215
const auto handle = futures.SafeAlloc <User *>(kUserFn_LinkWithCredential_DEPRECATED );
216
+ if (!credential.is_valid ()) {
217
+ futures.Complete (handle, kAuthErrorInvalidCredential , " Invalid credential is not allowed." );
218
+ return MakeFuture (&futures, handle);
219
+ }
212
220
[UserImpl (auth_data_)
213
221
linkWithCredential: CredentialFromImpl (credential.impl_)
214
222
completion: ^(FIRAuthDataResult *_Nullable auth_result, NSError *_Nullable error) {
@@ -224,6 +232,10 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
224
232
ReferenceCountedFutureImpl &futures = auth_data_->future_impl ;
225
233
const auto handle = auth_data_->future_impl .SafeAlloc <SignInResult>(
226
234
kUserFn_LinkAndRetrieveDataWithCredential , SignInResult ());
235
+ if (!credential.is_valid ()) {
236
+ futures.Complete (handle, kAuthErrorInvalidCredential , " Invalid credential is not allowed." );
237
+ return MakeFuture (&futures, handle);
238
+ }
227
239
AuthData *auth_data = auth_data_;
228
240
[UserImpl (auth_data)
229
241
linkWithCredential: CredentialFromImpl (credential.impl_)
@@ -279,6 +291,10 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
279
291
const auto handle = futures.SafeAlloc <User>(kUserFn_UpdatePhoneNumberCredential );
280
292
281
293
#if FIREBASE_PLATFORM_IOS
294
+ if (!credential.is_valid ()) {
295
+ futures.Complete (handle, kAuthErrorInvalidCredential , " Invalid credential is not allowed." );
296
+ return MakeFuture (&futures, handle);
297
+ }
282
298
FIRPhoneAuthCredential *objc_credential = PhoneAuthCredentialFromImpl (credential.impl_ );
283
299
[UserImpl (auth_data_)
284
300
updatePhoneNumberCredential: objc_credential
@@ -302,6 +318,10 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
302
318
const auto handle = futures.SafeAlloc <User *>(kUserFn_UpdatePhoneNumberCredential_DEPRECATED );
303
319
304
320
#if FIREBASE_PLATFORM_IOS
321
+ if (!credential.is_valid ()) {
322
+ futures.Complete (handle, kAuthErrorInvalidCredential , " Invalid credential is not allowed." );
323
+ return MakeFuture (&futures, handle);
324
+ }
305
325
FIRAuthCredential *objc_credential = CredentialFromImpl (credential.impl_ );
306
326
if ([objc_credential isKindOfClass: [FIRPhoneAuthCredential class ]]) {
307
327
[UserImpl (auth_data_)
@@ -341,6 +361,10 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
341
361
}
342
362
ReferenceCountedFutureImpl &futures = auth_data_->future_impl ;
343
363
const auto handle = futures.SafeAlloc <void >(kUserFn_Reauthenticate );
364
+ if (!credential.is_valid ()) {
365
+ futures.Complete (handle, kAuthErrorInvalidCredential , " Invalid credential is not allowed." );
366
+ return MakeFuture (&futures, handle);
367
+ }
344
368
345
369
[UserImpl (auth_data_)
346
370
reauthenticateWithCredential: CredentialFromImpl (credential.impl_)
@@ -359,6 +383,10 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
359
383
ReferenceCountedFutureImpl &futures = auth_data_->future_impl ;
360
384
const auto handle = auth_data_->future_impl .SafeAlloc <AuthResult>(
361
385
kUserFn_ReauthenticateAndRetrieveData , AuthResult ());
386
+ if (!credential.is_valid ()) {
387
+ futures.Complete (handle, kAuthErrorInvalidCredential , " Invalid credential is not allowed." );
388
+ return MakeFuture (&futures, handle);
389
+ }
362
390
AuthData *auth_data = auth_data_;
363
391
[UserImpl (auth_data)
364
392
reauthenticateWithCredential: CredentialFromImpl (credential.impl_)
@@ -376,6 +404,10 @@ explicit IOSWrappedUserInfo(id<FIRUserInfo> user_info) : user_info_(user_info) {
376
404
ReferenceCountedFutureImpl &futures = auth_data_->future_impl ;
377
405
const auto handle = auth_data_->future_impl .SafeAlloc <SignInResult>(
378
406
kUserFn_ReauthenticateAndRetrieveData_DEPRECATED , SignInResult ());
407
+ if (!credential.is_valid ()) {
408
+ futures.Complete (handle, kAuthErrorInvalidCredential , " Invalid credential is not allowed." );
409
+ return MakeFuture (&futures, handle);
410
+ }
379
411
AuthData *auth_data = auth_data_;
380
412
[UserImpl (auth_data)
381
413
reauthenticateWithCredential: CredentialFromImpl (credential.impl_)
0 commit comments