我一直在一个涉及firebase作为后端和Angulars的项目中工作,我目前面临的方式是返回一个包含所有firebase用户的列表。我可以看到文档中只有关于[ currentUser ] https://firebase.google.com/docs/auth/web/manage-users的信息,但我需要返回所有用户并管理它们,更新密码和电子邮件以及删除帐户。
我的旧方法工作得很好,但是众所周知,firebase已经改变了编写方法的方法,这是我的旧方法:
$scope.ChangePass = function() {
var email = $scope.data.email;
var passwordChanged = $scope.data.password;
var newPasswordChanged = $scope.data.newPassword;
var ref = new Firebase("https://myfirebaseapp.firebaseio.com/");
ref.changePassword({
email: email,
oldPassword: passwordChanged,
newPassword: newPasswordChanged
}, function(error) {
if (error) {
switch (error.code) {
case "INVALID_PASSWORD":
console.log("The specified user account password is incorrect.");
break;
case "INVALID_USER":
console.log("The specified user account does not exist.");
break;
default:
console.log("Error changing password:", error);
}
} else {
console.log("User password changed successfully!");
}
});
这是firebase的新方式,但问题是它只捕获当前用户。
$scope.ChagePassword = function(){
var user = firebase.auth().currentUser;
var newPassword = $scope.newpass.newPassword;
user.updatePassword(newPassword).then(function() {
console.log('password account changed successfully');
}, function(error) { console.log(error);
console.log('password account change failure');// An error happened.
});
}//END FUNCTION
有没有办法做到这一点? 提前致谢。