使用Facebook登录时,配置文件不会填写

时间:2016-05-14 00:27:35

标签: javascript facebook facebook-graph-api meteor ecmascript-6

在我的MeteorJs应用程序中,当他们使用Facebook登录时,您可以使用Facebook登录,他们的个人资料不会自动填写。

addFacebookInformationToProfile() {
    if (Meteor.isServer) {
      // This will only merge in information the first time, then ignore it once the flag is true
      const user = Meteor.user();
      let username = slugify(user.services.facebook.name, '');
      let i = 1;
      while (Meteor.users.findOne({username})) {
        username = slugify(user.services.facebook.name, '') + '' + i;
        i++;
      }
      Meteor.users.update({ _id: Meteor.userId(), 'profile.facebook': { $ne:true }}, {
        $set: {
          'profile.email': user.services.facebook.email,
          'profile.name': user.services.facebook.name,
          'username': username,
          'profile.gender': user.services.facebook.gender,
          'profile.picture': "https://graph.facebook.com/" + user.services.facebook.id + "/picture/?width=150&height=150",
          'profile.facebook': true
        }
      });
    }
  },

当我console.log profile.picture行时,我得到一个网址,当在浏览器中输入时,它会显示Facebook用户的个人资料图片。

例如:(http://graph.facebook.com/100004071683764/picture/?width=150&height=150

这是它在实际应用中的显示方式:(https://www.dropbox.com/s/6n1svdq56x6ctx8/Screenshot%202016-05-13%2017.24.06.png?dl=0

如何在上方的圆圈中显示用户的个人资料图片,而不是圆圈周围的灰色框。

背景:

我们正在使用imgix和s3来获取我们的数据。

这个应用程序在这里托管了relphe.com

1 个答案:

答案 0 :(得分:0)

使用

 <img class="img-circle" > 

这会使您的个人资料照片显示在一个圆圈中。