User Accounts

34 views
Skip to first unread message

Breon Knight

unread,
Jun 7, 2016, 3:44:39 AM6/7/16
to Firebase + EmberJS
Hi,

I'm following the current guide of how to make a user account. I have two models that separate two different kinds of accounts. For example I want to use the createUser function but also pass in an a model while creating that user.

My controller is like this.

import Ember from 'ember';

export default Ember.Controller.extend({
  firebase: Ember.inject.service(),
  action: {
    var newArtist = this.store.createRecord('artist', {
      artistName: this.get('artistName'),
      email: this.get('email'),
      password: this.get('password')
    });
    newArtist.save();
  }
});

How could I still use the createUser account in conjunction to still use the auth provided with firebase.

Breon

unread,
Jun 8, 2016, 3:50:19 AM6/8/16
to Firebase + EmberJS
I've worked somewhat through this problem

import Ember from 'ember';
import Firebase from 'firebase';

export default Ember.Controller.extend({
  actions: {
    signUp: function() {
      var artistName = this.get('artistName');
      var email = this.get('email');
      var password = this.get('password');
      var ref = new Firebase("https://bandpass.firebaseio.com/");

      ref.createUser({
        email: email,
        password: password
      }, function(error, userData) {
        if (error) {
          alert(error);
        } else {
          this.get('session').open('firebase', {
            provider: 'password',
            'email': email,
            'password': password
          }).then(function(){
            var artist = this.store.createRecord('artist', {
              id: userData.uid,
              artistName: artistName
            });
            artist.save()
            .then(function(){
              this.transitionTo('index');
            });
          });
        }
      });
    }
  }
});


My data isn't showing but my emails are



Reply all
Reply to author
Forward
0 new messages