Firebase错误:指定的电子邮件地址无效

时间:2015-04-27 06:31:40

标签: ember.js firebase emberfire

即使我创建了一个帐户来测试登录,我仍然在我的Ember-Firebase应用中收到错误“指定的电子邮件地址无效”。

我想知道它是否与我将信息作为字符串传递的方式有关?

初​​始化/ emberfire.js

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


var session = Ember.Object.extend({
    ref : new Firebase("https://nutella.firebaseio.com"),

    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("https://nutella.firebaseio.com");

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

如果你能指出我正确的方向,我真的很感激!

1 个答案:

答案 0 :(得分:0)

传递字符串应该不是问题。以下是一些建议:

  1. (这可能很明显,但是......)好像你把空字符串传递给LOCAL_PATH := $(call my-dir) #leptonica LEPTONICA_LOCAL := $(LOCAL_PATH)/com_googlecode_leptonica_android LEPTONICA_PATH := $(LEPTONICA_LOCAL)/src include $(CLEAR_VARS) LOCAL_MODULE := liblept LOCAL_SRC_FILES := ../libs/$(TARGET_ARCH_ABI)/liblept.so LOCAL_EXPORT_C_INCLUDES := \ $(LEPTONICA_LOCAL) \ $(LEPTONICA_PATH)/src include $(PREBUILT_SHARED_LIBRARY) #tesseract TESSERACT_LOCAL := $(LOCAL_PATH)/com_googlecode_tesseract_android TESSERACT_PATH := $(TESSERACT_LOCAL)/src include $(CLEAR_VARS) LOCAL_MODULE := libtess LOCAL_SRC_FILES := ../libs/$(TARGET_ARCH_ABI)/libtess.so LOCAL_EXPORT_C_INCLUDES := \ $(LOCAL_PATH) \ $(TESSERACT_PATH)/api \ $(TESSERACT_PATH)/ccmain \ $(TESSERACT_PATH)/ccstruct \ $(TESSERACT_PATH)/ccutil \ $(TESSERACT_PATH)/classify \ $(TESSERACT_PATH)/cube \ $(TESSERACT_PATH)/cutil \ $(TESSERACT_PATH)/dict \ $(TESSERACT_PATH)/opencl \ $(TESSERACT_PATH)/neural_networks/runtime \ $(TESSERACT_PATH)/textord \ $(TESSERACT_PATH)/viewer \ $(TESSERACT_PATH)/wordrec \ $(LEPTONICA_PATH)/src \ $(TESSERACT_LOCAL) LOCAL_SHARED_LIBRARIES := liblept include $(PREBUILT_SHARED_LIBRARY) #opencv include $(CLEAR_VARS) OPENCV_PACKAGE_DIR:= /Users/danielsierraf/Documents/OpenCV-2.4.10-android-sdk/sdk OPENCV_CAMERA_MODULES := off include $(OPENCV_PACKAGE_DIR)/native/jni/OpenCV.mk LOCAL_MODULE := run_detection LOCAL_SRC_FILES := text_detect.cpp android.cpp LOCAL_LDLIBS += -landroid -llog -ldl LOCAL_SHARED_LIBRARIES += libtess liblept include $(BUILD_SHARED_LIBRARY)
  2. createUser
    1. 假设您故意从代码中删除了字符串,还有一个事实是您正在传递session.get('ref').createUser({ name: "", email: "", password: "" }, 一个额外的参数Firebase.createUser()
    2. .createUser() documentation中,参数列为:

        

      name 对象
        包含与新用户帐户对应的电子邮件和密码属性的对象。

           

      credentials 功能
        创建用户帐户时将调用的回调函数。失败时,第一个参数将是一个表示失败的Error对象,具有机器可读的代码属性。成功时,第一个参数将为null,第二个参数将是包含新创建用户的属性的对象,包括uid。

      所以,这是您对onComplete的调用的修订版本:

      createUser()

      如果没有这样做,你能否提供更多信息 - 你在哪里(行号)收到错误?

      希望有所帮助。