mirror of
https://github.com/vale981/Vulcan
synced 2025-03-10 04:26:41 -04:00
20 lines
571 B
JavaScript
20 lines
571 B
JavaScript
![]() |
Meteor.methods({
|
||
|
// not used for now
|
||
|
changeEmail: function (userId, newEmail) {
|
||
|
var user = Meteor.users.findOne(userId);
|
||
|
if (Users.can.edit(Meteor.user(), user) !== true) {
|
||
|
throw new Meteor.Error("Permission denied");
|
||
|
}
|
||
|
Meteor.users.update(
|
||
|
userId,
|
||
|
{$set: {
|
||
|
emails: [{address: newEmail, verified: false}],
|
||
|
emailHash: Gravatar.hash(newEmail),
|
||
|
// Just in case this gets called from somewhere other than /client/views/users/user_edit.js
|
||
|
"profile.email": newEmail
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
});
|