|
@@ -63,11 +63,23 @@ if (isSandstorm && Meteor.isServer) {
|
|
// accesses the document, but in case a already known user comes back, we
|
|
// accesses the document, but in case a already known user comes back, we
|
|
// need to update his associated document to match the request HTTP headers
|
|
// need to update his associated document to match the request HTTP headers
|
|
// informations.
|
|
// informations.
|
|
|
|
+ // XXX We need to update this document even if the initial route is not `/`.
|
|
|
|
+ // Unfortuanlty I wasn't able to make the Webapp.rawConnectHandlers solution
|
|
|
|
+ // work.
|
|
const user = Users.findOne({
|
|
const user = Users.findOne({
|
|
'services.sandstorm.id': req.headers['x-sandstorm-user-id'],
|
|
'services.sandstorm.id': req.headers['x-sandstorm-user-id'],
|
|
});
|
|
});
|
|
if (user) {
|
|
if (user) {
|
|
- updateUserPermissions(user._id, user.permissions);
|
|
|
|
|
|
+ // XXX At this point the user.services.sandstorm credentials haven't been
|
|
|
|
+ // updated, which mean that the user will have to restart the application
|
|
|
|
+ // a second time to see its updated name and avatar.
|
|
|
|
+ Users.update(user._id, {
|
|
|
|
+ $set: {
|
|
|
|
+ 'profile.fullname': user.services.sandstorm.name,
|
|
|
|
+ 'profile.avatarUrl': user.services.sandstorm.picture,
|
|
|
|
+ },
|
|
|
|
+ });
|
|
|
|
+ updateUserPermissions(user._id, user.services.sandstorm.permissions);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -107,6 +119,7 @@ if (isSandstorm && Meteor.isServer) {
|
|
$set: {
|
|
$set: {
|
|
username: generateUniqueUsername(username, appendNumber),
|
|
username: generateUniqueUsername(username, appendNumber),
|
|
'profile.fullname': doc.services.sandstorm.name,
|
|
'profile.fullname': doc.services.sandstorm.name,
|
|
|
|
+ 'profile.avatarUrl': doc.services.sandstorm.picture,
|
|
},
|
|
},
|
|
});
|
|
});
|
|
|
|
|