Can i add/change password of another user in meteor?

I’m trying to make a user management app where is want to give my user with admin privileges to create users and define their password and role as well. Also, in future admin can be able to change the password. Is that possible in the meteor ? I’m using the core accounts-password package.

Any suggestions ?

1 Like

It’s indeed possible :

Hi @sarthak, did you manage to implement this?
How did you go about transmitting the password to the server?

In server code:

Meteor.methods({
    changePassword:function(userId,password){
        if(Meteor.user().admin && password.length > 8){
            Accounts.setPassword(userId,password);
        }
    }
});

On the client:

var userId = 'whatever', password = 'blablabla';
Meteor.call('changePassword',userId,password);

Note: I’m not sure if this sends the password unencrypted over the wire when you call the changePassword method (in case you’re not using HTTPS).

1 Like