Skip to content

Commit

Permalink
added afterUserCreated trigger after first CAS login
Browse files Browse the repository at this point in the history
  • Loading branch information
AmShaegar13 committed Dec 8, 2017
1 parent b444159 commit 597eb07
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions server/lib/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,18 @@ Accounts.insertUserDoc = _.wrap(Accounts.insertUserDoc, function(insertUserDoc,
_id
});

if (user.username && options.joinDefaultChannels !== false && user.joinDefaultChannels !== false) {
Meteor.runAsUser(_id, function() {
return Meteor.call('joinDefaultChannels', options.joinDefaultChannelsSilenced);
});
if (user.username) {
if (options.joinDefaultChannels !== false && user.joinDefaultChannels !== false) {
Meteor.runAsUser(_id, function() {
return Meteor.call('joinDefaultChannels', options.joinDefaultChannelsSilenced);
});
}

if (user.type !== 'visitor') {
Meteor.defer(function() {
return RocketChat.callbacks.run('afterCreateUser', user);
});
}
}

if (roles.length === 0) {
Expand Down

0 comments on commit 597eb07

Please sign in to comment.