我正在尝试重置我的angularjs App上的密码。我使用Parse(js SDK)作为后端。 我正在使用Parse.User.requestPasswordReset,如文档中所述,但我总是收到错误125无效的电子邮件地址。
这是我的html表单:
<input type="email" ng-model="resetData.email" required>
<button ng-click="resetPassword(resetData)">
Ok
</button>
这是我的控制器:
app.controller('userCtrl', function($scope, loginService){
$scope.resetPassword = function(resetData){
loginService.resetPassword(resetData,$scope);
};
});
最后这是我的工厂:
app.factory('loginService', function(){
return{
resetPassword:function(resetData,scope){
console.log(resetData.email);
Parse.User.requestPasswordReset(resetData.email,{
success:function(){
alert('You'll receive an email to reset your password');
},
error:function(error){
if (error.code === 205) {
scope.msg_erreur='User not found';
console.log("error "+error.code+" "+error.message);
}
else{
scope.msg_erreur='Oops ! Something wrong happened';
console.log("error "+error.code+" "+error.message);
};
}
})
}
}
});
很高兴知道:
在每种情况下,我总是有这个错误125无效的电子邮件地址。
有没有人有想法?
由于
答案 0 :(得分:1)
我认为您将电子邮件地址存储在username
字段中,并允许用户以此方式登录。将电子邮件地址也放在email
字段中,重置电子邮件应该按预期结束。
这似乎与Parse处理重置的方式有关,因为这不是以前的问题。这种解决方法并不优雅,但在问题从最终得到妥善解决之前一直有效。