samedi 30 avril 2016

Firebase, Ember and Emberfire create user

Firebase offers some easy ways to create users:

I'm currently using EmberFire (Add-on) with Firebase, and I'm wondering how this would translate to use in Ember:

var ref = new Firebase("http://ift.tt/1Fh4OSN");
ref.createUser({
  email: "bobtony@firebase.com",
  password: "correcthorsebatterystaple"
}, function(error, userData) {
  if (error) {
    switch (error.code) {
      case "EMAIL_TAKEN":
        console.log("The new user account cannot be created because the email is already in use.");
        break;
      case "INVALID_EMAIL":
        console.log("The specified email is not a valid email.");
        break;
      default:
        console.log("Error creating user:", error);
    }
  } else {
    console.log("Successfully created user account with uid:", userData.uid);
  }
});

So you can then create a user, save it to Ember Data and also save it in Firebase? There are also other methods changeEmail(), changePassword() etc... so I'm simply looking for an example to apply this to Emberfire ?




Aucun commentaire:

Enregistrer un commentaire