firebase重置密码控制器
昨天,我的应用程序Ionic v1启动,一些用户输入了错误的密码,无法登录该应用程序。 该应用程序使用firebase身份验证。我有一个指向数据库的_refs文件,并尝试了许多方法试图让重置生效。 我尝试过引用$firebaseAuth,当然是我的u refs,$firebase,然后使用$firebase.auth。。。 我没有编写此应用程序的身份验证,因此我不确定它是如何工作的。我希望有人能帮助我 我的重置控制器firebase重置密码控制器,firebase,ionic-framework,Firebase,Ionic Framework,昨天,我的应用程序Ionic v1启动,一些用户输入了错误的密码,无法登录该应用程序。 该应用程序使用firebase身份验证。我有一个指向数据库的_refs文件,并尝试了许多方法试图让重置生效。 我尝试过引用$firebaseAuth,当然是我的u refs,$firebase,然后使用$firebase.auth。。。 我没有编写此应用程序的身份验证,因此我不确定它是如何工作的。我希望有人能帮助我 我的重置控制器 angular.module('formulaWizard').control
angular.module('formulaWizard').controller('ResetPasswordCtrl',
函数$scope、$ionicLoading、$firebaseAuth、\uu参考{
$scope.user={
电邮:
};
$scope.errorMessage=null
var fbAuth = $firebaseAuth(__Refs.rootRef);
$scope.resetPassword = function() {
$scope.errorMessage = null;
$ionicLoading.show({
template: 'Please wait...'
});
fbAuth.sendPasswordResetEmail($scope.user.email)
.then(showConfirmation)
.catch(handleError);
};
function showConfirmation() {
$scope.emailSent = true;
$ionicLoading.hide();
}
function handleError(error) {
switch (error.code) {
case 'INVALID_EMAIL':
case 'INVALID_USER':
$scope.errorMessage = 'Invalid email';
break;
default:
$scope.errorMessage = 'Error: [' + error.code + ']';
}
$ionicLoading.hide();
}
});
我的参考文件
angular.module('formulaWizard')
.factory('__Refs', function ($firebaseArray, $firebaseObject) {
// Might use a resource here that returns a JSON arrayf
var ref = new Firebase('https://firebasedatabase.com/');
return {
rootRef: ref,
customers: ref.child('customers'),
}
});
我不能相信阿比姆博拉·伊多乌在《黑客之手》中给出的答案。 因为我为答案付费,所以我想我会和其他可能会被这个问题难倒的人分享
$scope.resetPassword = function() {
$scope.errorMessage = null;
$ionicLoading.show({
template: 'Please wait...'
});
__Refs.rootRef.resetPassword({ email: $scope.user.email }, function(error) {
if (error === null) {
showConfirmation();
} else {
handleError()
}
});
};
这是参考文献服务
angular.module('formulaWizard')
.factory('__Refs', function ($firebaseArray, $firebaseObject) {
// Might use a resource here that returns a JSON arrayf
var ref = new Firebase('https://firebasedatabase.com/');
return {
rootRef: ref,
}
});