Angular Firebase 無法啟用重置密碼



当我尝试调用此函数时,我的代码Uncaught TypeError: _baseUrl.resetPassword is not a function抛出错误。

以下是我配置火力对象的方式

    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",但它没有方法重置密码

请提前帮助和感谢

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');
                });

        }

我已经使用此功能重置密码,并且工作正常。

相关内容

  • 没有找到相关文章

最新更新