Angular Firebase 无法调用重置密码
Angular Firebase not able to invoke Reset Password
当我尝试调用此函数时,我的代码抛出错误 Uncaught TypeError: _baseUrl.resetPassword is not a function
。
以下是我配置 firebase 对象的方式
var firebaseConfig = {
apiKey: "my api key",
authDomain: "my-domain.firebaseapp.com",
databaseURL: "https://collection-name.firebaseio.com",
projectId: "my-project-id-1111",
storageBucket: "my-storage-bucket.appspot.com",
messagingSenderId: "XXXXXXXXXX",
appId: "1:XXXXXXXXX:web:XXXXXXXXXX"
};
// Initialize Firebase
var _firebase = firebase.initializeApp(firebaseConfig);
var _baseUrl = _firebase.database().ref("web/data");
var _baseAuth = _firebase.auth();
function resetPassword(userEmail) {
_baseUrl.resetPassword({
email: userEmail
}, function(error) {
console.log(error);
if (error === null) {
return false;
} else {
return error;
}
});
}
当我调用 resetPassowrd 函数时,它抛出一个错误。
Uncaught TypeError: _baseUrl.resetPassword is not a function
我已通过调试检查我在我的函数中收到“_baseUrl”,但它没有方法 resetPassword
请帮助并提前致谢
var firebaseConfig = {
apiKey: "my api key",
authDomain: "my-domain.firebaseapp.com",
databaseURL: "https://collection-name.firebaseio.com",
projectId: "my-project-id-1111",
storageBucket: "my-storage-bucket.appspot.com",
messagingSenderId: "XXXXXXXXXX",
appId: "1:XXXXXXXXX:web:XXXXXXXXXX"
};
// Initialize Firebase
var _firebase = firebase.initializeApp(firebaseConfig);
var _baseUrl = _firebase.database().ref("web/data");
var _baseAuth = _firebase.auth();`enter code here`
function resetPassword(userEmail) {
_baseAuth.sendPasswordResetEmail(
userEmail, actionCodeSettings=null)
.then(function() {
console.log('email sent');
})
.catch(function(error) {
console.log('error occurred');
});
}
我已经用这个功能重设了密码,效果很好。
当我尝试调用此函数时,我的代码抛出错误 Uncaught TypeError: _baseUrl.resetPassword is not a function
。
以下是我配置 firebase 对象的方式
var firebaseConfig = {
apiKey: "my api key",
authDomain: "my-domain.firebaseapp.com",
databaseURL: "https://collection-name.firebaseio.com",
projectId: "my-project-id-1111",
storageBucket: "my-storage-bucket.appspot.com",
messagingSenderId: "XXXXXXXXXX",
appId: "1:XXXXXXXXX:web:XXXXXXXXXX"
};
// Initialize Firebase
var _firebase = firebase.initializeApp(firebaseConfig);
var _baseUrl = _firebase.database().ref("web/data");
var _baseAuth = _firebase.auth();
function resetPassword(userEmail) {
_baseUrl.resetPassword({
email: userEmail
}, function(error) {
console.log(error);
if (error === null) {
return false;
} else {
return error;
}
});
}
当我调用 resetPassowrd 函数时,它抛出一个错误。
Uncaught TypeError: _baseUrl.resetPassword is not a function
我已通过调试检查我在我的函数中收到“_baseUrl”,但它没有方法 resetPassword
请帮助并提前致谢
var firebaseConfig = {
apiKey: "my api key",
authDomain: "my-domain.firebaseapp.com",
databaseURL: "https://collection-name.firebaseio.com",
projectId: "my-project-id-1111",
storageBucket: "my-storage-bucket.appspot.com",
messagingSenderId: "XXXXXXXXXX",
appId: "1:XXXXXXXXX:web:XXXXXXXXXX"
};
// Initialize Firebase
var _firebase = firebase.initializeApp(firebaseConfig);
var _baseUrl = _firebase.database().ref("web/data");
var _baseAuth = _firebase.auth();`enter code here`
function resetPassword(userEmail) {
_baseAuth.sendPasswordResetEmail(
userEmail, actionCodeSettings=null)
.then(function() {
console.log('email sent');
})
.catch(function(error) {
console.log('error occurred');
});
}
我已经用这个功能重设了密码,效果很好。