mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
parent
db49d9746c
commit
7015663741
2 changed files with 8 additions and 4 deletions
|
@ -89,7 +89,7 @@ Template[getTemplate('userAccount')].events({
|
|||
});
|
||||
});
|
||||
|
||||
Meteor.call('changeEmail', email);
|
||||
Meteor.call('changeEmail', user._id, email);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -57,11 +57,15 @@ Accounts.onCreateUser(function(options, user){
|
|||
|
||||
|
||||
Meteor.methods({
|
||||
changeEmail: function (newEmail) {
|
||||
changeEmail: function (userId, newEmail) {
|
||||
var user = Meteor.users.findOne(userId);
|
||||
if (can.edit(user) !== true) {
|
||||
throw new Meteor.Error("Permission denied");
|
||||
}
|
||||
Meteor.users.update(
|
||||
Meteor.userId(),
|
||||
userId,
|
||||
{$set: {
|
||||
emails: [{address: newEmail}],
|
||||
emails: [{address: newEmail, verified: false}],
|
||||
email_hash: Gravatar.hash(newEmail),
|
||||
// Just in case this gets called from somewhere other than /client/views/users/user_edit.js
|
||||
"profile.email": newEmail
|
||||
|
|
Loading…
Add table
Reference in a new issue