Question

I am trying out meteor and am building a very simple app. it has 2 log in/register methods: google and normal username/password.

My issue is with username/password login type. There is no option to add additional profile fields, particularly 'name'.

Users who register using google all have a name, but users who register using email and password do not.

How can i fix this?

Was it helpful?

Solution

The best way to fix this would be to implement your own registration UI and not use the accounts-ui package for registration. The logged in bit of it takes the name from Meteor.user().profile.name. You could fill this in using a manual account creation process:

You can use something like this to register:

Accounts.createUser({
    username: 'username_here',
    password: 'password_here',
    email: 'email_here',
    profile: {
        name: 'Name here'
    }
}, function(err) {

   if(!err) {
       //Do something - the user is registered
   }else{
       alert(err.reason);
   }
});

You could perhaps still use the accounts-ui package to log in and disable the register link using CSS.

#login-buttons #signup-link {
    display: none;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top