meteor-chat-tutorial icon indicating copy to clipboard operation
meteor-chat-tutorial copied to clipboard

If no Meteor Account

Open AppDevGuy opened this issue 10 years ago • 0 comments

If the user following the tutorial has not got a Meteor account, the profile user name will be empty. Can I suggest the following inside the Template.input.events function:

if (Meteor.user()){
    // since we are logged in using github, let's use the github user name
    var name = Meteor.user().services.github.username;;

    // if you want to use your Meteor name use:
    // var name = Meteor.user().profile.name;
    var message = document.getElementById('message');
}
else{
    var name = 'Anonymous';
    var message = document.getElementById('message');
}

Kind regards

AppDevGuy

AppDevGuy avatar Oct 10 '15 16:10 AppDevGuy