简体   繁体   中英

Changing a user's email/password in Firebase 3 for iOS

I'm looking for the new class and methods that replace 'changeEmailForUser' and 'changePasswordForUser' on the Firebase class after today's major update. I assume they're now a part of FIRAuth, but I can't seem to find anything. Can somebody point me in the right direction?

The docs are a bit confusing but at the bottom of the "Manage Users" section which is under "iOS" which is under "Authentication" which is here

According to the docs, to update a user's email address:

FIRUser *user = [FIRAuth auth].currentUser;

[user updateEmail:@"user@example.com" completion:^(NSError *_Nullable error) {
  if (error) {
    // An error happened.
  } else {
    // Email updated.
  }
}];

and for password:

FIRUser *user = [FIRAuth auth].currentUser;
NSString *newPassword = [yourApp getRandomSecurePassword];

[user updatePassword:newPassword completion:^(NSError *_Nullable error) {
  if (error) {
    // An error happened.
  } else {
    // Password updated.
  }
}];

other important information regarding emails for password resets are all at the link given above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM