如何确定用户在 Meteor 中使用的登录类型?
How to Determine Type of Login that User Used in Meteor?
我正在寻找确定用户用于登录系统的服务类型的最佳方法。我的意思是像 Meteor.user().typeOfLogin() 这样的东西会 return 例如 ('facebook', 'google', 'password')... 或者至少有人知道如何手动检查它的可靠方法。
我查看了官方文档,但没有发现任何有用的东西:http://guide.meteor.com/accounts.html
您需要在项目中添加 underscore
。
Meteor.users.helpers({
typeOfLogin: function() {
if (_.has(this.services, 'facebook'))
return 'facebook';
if (_.has(this.services, 'google'))
return 'google';
}
});
我正在寻找确定用户用于登录系统的服务类型的最佳方法。我的意思是像 Meteor.user().typeOfLogin() 这样的东西会 return 例如 ('facebook', 'google', 'password')... 或者至少有人知道如何手动检查它的可靠方法。
我查看了官方文档,但没有发现任何有用的东西:http://guide.meteor.com/accounts.html
您需要在项目中添加 underscore
。
Meteor.users.helpers({
typeOfLogin: function() {
if (_.has(this.services, 'facebook'))
return 'facebook';
if (_.has(this.services, 'google'))
return 'google';
}
});