2013-12-08 240 views
0

我正在嘗試爲我的angularFire firebase實施註冊。我有各種形式的登錄工作,包括本地和社交解決方案。但我對如何爲那些不使用社交媒體網站的人創建註冊表感到困惑。簡單的登錄不起作用,但我必須自己添加用戶名和密碼。有沒有人需要處理這個問題,或者有誰找到了解決方案來AngularFire簡單的登錄註冊。我非常感謝任何幫助。爲了讓你知道我在這裏的位置是登錄控制器。AngularFire身份驗證註冊

var ref = new Firebase("https://<<myfirebase>>.firebaseio.com"); 
angularFireAuth.initialize(ref, { 
scope: $scope, name: "user", 
callback: function(err, user) { 
    if (!err) { 
     console.log("User :", user); 
    } else { 
     console.log("Error :", err); 
    } 
} 
}); 
$scope.login = function() { 
console.log("logging in"); 
var username = $scope.form.email; 
var password = $scope.form.password; 
angularFireAuth.login('password', { 
    email: username, 
    password: password, 
    rememberMe: false 
    }); 
}; 

$scope.loginTwitter = function() { 
    console.log('loggin in via Twitter'); 
    angularFireAuth.login('twitter'); 
}; 

$scope.loginFacebook = function() { 
    console.log('loggin in via Facebook'); 
    angularFireAuth.login('facebook'); 
}; 

$scope.loginGithub = function() { 
    console.log('loggin in via Github'); 
    angularFireAuth.login('github'); 
}; 

$scope.logout = function() { 
    angularFireAuth.logout(); 
}; 

回答

0

使用angularFireAuth.createUser方法以編程方式創建一個新用戶(基於用戶輸入註冊表單上的大多數情況下):

function createNewUser(email, pw) { 
    angularFireAuth.createUser(email, password, callback); 
} 

當用戶已經回調會被調用成功創建(或出現錯誤)。通常,您需要將此方法綁定到表單的提交按鈕。