Mpondomise Mpondomise - 1 month ago 5
AngularJS Question

angularjs $confirmPasswordReset is not a function

I am trying to set up firebase

confirmPasswordReset
in order to create a custom email action handlers. Here is what I have:


app.controller("ResetPass", ["$scope", "$firebaseAuth", "$location", function ($scope, $firebaseAuth, $location) {

$scope.resetMe = function () {
var newPassword = $scope.user.password;
var actionCode = $location.search().oobCode;
var mode = $location.search().mode;
console.log(actionCode);
console.log(newPassword);
console.log(mode);
var auth = $firebaseAuth();
auth.$confirmPasswordReset(actionCode, newPassword).then(function (resp) {
console.log("reset pass, done");
$scope.errMsg = false;
$location.path('/login.signin');
}).catch(function (error) {
$scope.errMsg = true;
$scope.errorMessage = error.message;
});
}

}]);


i am refering to the documentation here


I get the following error:


enter image description here


How can I fix this?



Note: my other firebase controllers are working, login and registration.

AHC AHC
Answer

you gotta change it to this by removing the firebaseauth and replacing it with firebase:

app.controller("ResetPass", ["$scope","firebase",  "$location", function ($scope,firebase,  $location) {

    $scope.resetMe = function () {
        var newPassword = $scope.user.password;
        var actionCode = $location.search().oobCode;
        var mode = $location.search().mode;
        console.log(actionCode);
        console.log(newPassword);
        console.log(mode);
        //var auth = $firebaseAuth();
        firebase.auth().confirmPasswordReset(actionCode, newPassword).then(function (resp) {
            console.log("reset pass, done");
            //$scope.errMsg = false;
            $location.path('/login.signin');
        }).catch(function (error) {
            $scope.errMsg = true;
            $scope.errorMessage = error.message;
        });
    }

}]);
Comments