I can not imagine how to reset the Firebase Auth object after loading it for the first time.
I am looking for the value bool true in auth.password.isTemporaryPassword , which forces the user to reset their password. After the user has completed this procedure and reset, auth.password.isTemporaryPassword will remain true .
The only way I found is to register the user and log back in by updating the auth object.
Login:
var ref = new Firebase(environment); $firebaseAuth(ref) .$authWithPassword({ email: email, password: password },sessionObj) .then(function(authData) { if (password.isTemporaryPassword === true) { $state.go('resetpassword'); } }) .catch(function(error) { deferred.reject(error); });
reset password:
$scope.reset.oldPassword = "oldPass"; $scope.reset.newPassword = "newPass"; $scope.reset.email = "usermail"; ref.changePassword($scope.reset, function(err) { if(err) { ... } else { $state.go('home') } })
password.isTemporaryPassword remains true until I log into the system again, which seems hacked.
source share