dimanche 26 avril 2015

Firebase error: The specified email address is invalid

I keep getting the error "The specified email address is invalid" in my Ember-Firebase app, even if I created an account just to test log in.

I'm wondering if it has to do with the way I'm passing information as a string?

initializer/emberfire.js

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


var session = Ember.Object.extend({
    ref : new Firebase("http://ift.tt/1DWdd0s"),

    addFirebaseCallback: function() {
        var session = this;
        var isNewUser = true;

        this.get("ref").onAuth(function(authData) {
            if (authData) {
                session.set("isAuthenticated", true);
            } else if (authData && isNewUser) {
                session.get("ref").child("users").child(authData.uid).set({
                    provider: authData.provider,
                    name: getName(authData)
                });
            } else {
                session.set("isAuthenticated", false);
            }
        });
    }.on("init"),

    createUser: function() {
        var session = this;
        return new Ember.RSVP.Promise(function(resolve, reject) {
            session.get('ref').createUser({
                        name: "",
                        email: "",
                        password: ""
            },

            function(error, userData) {
                    if (userData) {
                        resolve(userData.uid);
                        session.set("isNewUser", true);
                    } else {
                        reject(error);
                    }
                });
        });
    },

application.js

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

var ref = new Firebase("http://ift.tt/1DWdd0s");

export default Ember.Route.extend({
    actions: {
        createUser: function() {
            var controller = this;
            controller.get('session').createUser().then(function(user) {
                }, function() {
                });
        },

I'd really appreciate if you could point me in the right direction!




Aucun commentaire:

Enregistrer un commentaire