我正在研究 Angular Meteor 教程,该教程使用 Ionic 创建 WhatsApp 克隆。我将电话验证更改为使用用户名/密码的普通用户设置。
帐户是使用创建的
Accounts.createUser(email,password,callback)
当他们注销并尝试重新登录时,我有一个现有用户可以用来填写其电子邮件和密码的表单。我无法获取
Meteor.loginWithPassword(email,password,callback)
适用于此场景的方法;它一直说我有 400 错误,即“匹配失败”。以下是创建帐户后登录用户的代码:
表格:
<label class="item item-input">
<input ng-model="logger.existingEmail" on-return="logger.loginExistingUser()" type="text" placeholder="Your existing email">
</label>
<br>
<label class="item item-input">
<input ng-model="logger.existingPassword" on-return="logger.loginExistingUser()" type="text" placeholder="Your existing password">
</label>
JS:
login() {
if (_.isEmpty(this.existingEmail) ||_.isEmpty(this.existingPassword)) return;
Meteor.loginWithPassword(this.existingEmail,this.existingPassword,function(err){
if(err){
console.log(err);
}
});
}
- 我创建了多个帐户并尝试了以下操作:
- 使用电子邮件和密码登录
- 使用用户 ID 和密码登录(在 mongodb 中生成的用户 ID)
- 直接将电子邮件和密码传递给 Meteor.loginWithPassword
- 传入用户 ID 并直接传递给 Meteor.loginWithPassword
这些变量在 Meteor.loginWithPassword 调用之前有效。
我正在使用:
accounts-password 1.3.3
meteor 1.4.2.3
有什么建议吗?抱歉,帖子的格式很差,我很着急,只是想提出这个问题。预先感谢您!
最佳答案
已解决。包
mys:accounts-phone
导致了错误。删除此包并正常登录。
关于javascript - Meteor Accounts.loginWithPassword "400 Match Failed"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41600480/