删除用户无效

Removing a user is not working

本文关键字:无效 用户 删除      更新时间:2023-09-26

我正试图删除angularfire项目中的一个用户。电子邮件和密码可以正确传递,但由于某些原因,此方法无法执行。以下是我的身份验证服务中的代码(我添加了一些解释性注释):

removeUser: function (email, password) {
                console.log(email); --> Correct Email
                console.log(password); --> Correct password
                auth.$removeUser(email, password, function (succes, error) {
                    console.log('in removeUser'); --> Does not print
                    if (!error) {
                        console.log('user deleted'); --> Also doesn't print
                    } else {
                        console.log(error); --> You guessed it, doesn't print
                    }
                });
                console.log('Why am I even here?'); --> Does print
            }

auth变量是正确的,我没有收到任何错误。

这就是我获取angularfire ref的方式,其他方法,如$createUser和$login都能正常工作:

var ref = new Firebase(FIREBASE_URL);
var auth = $firebaseSimpleLogin(ref);

编辑#2:我注意到resetpassword确实有效,但回调没有发生。有人知道为什么吗?无论我输入的是错误的还是正确的旧密码,它都不会打印任何

resetpassword: function (email, oldPassword, newPassword) {
                return auth.$changePassword(email, oldPassword, newPassword, function (error) {
                    console.log('in resetpass auth'); //doesn't print, no errors
                    if (!error) {
                        console.log('Password changed succesfully'); 
                    } else {
                        console.log(error); 
                    }
                });
            }

当直接使用Firebase Simple Login时,上面引用的方法接受回调作为最终参数。然而,当通过AngularFire使用Firebase+AngularJS时,这些方法被包装为对Angular开发更友好,并返回promise而不是接受的回调。

请参阅https://www.firebase.com/docs/angular/reference.html#changepassword-有关更多详细信息,请发送电子邮件至oldpassword newpassword。